Bug 701 - PulseView APK doesn't start up on Android 5 and Android 6
Summary: PulseView APK doesn't start up on Android 5 and Android 6
Status: RESOLVED FIXED
Alias: None
Product: PulseView
Classification: Unclassified
Component: Portability (show other bugs)
Version: unreleased development snapshot
Hardware: ARM Android
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords:
: 856 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-15 23:05 CET by Flip
Modified: 2017-04-19 23:08 CEST (History)
6 users (show)



Attachments
logfile (9.10 KB, application/octet-stream)
2015-11-15 23:05 CET, Flip
Details
Log from first start of Pulseview crashing on Android 6.0.1 (62.65 KB, text/plain)
2016-02-08 15:20 CET, Flip
Details
new log (16.79 KB, text/plain)
2016-02-09 19:55 CET, Flip
Details
crash thombstone (211.53 KB, text/plain)
2016-02-09 20:09 CET, Flip
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Flip 2015-11-15 23:05:27 CET
Created attachment 186 [details]
logfile

Current .apk  Nightly crashes while Starting on my System.

Device: Samsung G901f
Android: 5.1.1
Comment 1 Flip 2015-11-15 23:20:40 CET
information about QT lib found:
https://bugreports.qt.io/browse/QTBUG-46355
Comment 2 majenko 2016-01-28 14:17:01 CET
This also happens on the Samsung Galaxy Tab A (SM-T555)

* Android 5.0.2
Comment 3 Uwe Hermann 2016-02-03 10:54:55 CET
Hi, please retry the latest APK, it is upgraded to Qt 5.5.1 now, which looks like it should fix QTBUG-46355, so maybe that helps.

If not, please attach an updated log if possible. Both the old and new APKs work fine for me on an Android 4.4.2 tablet.
Comment 4 majenko 2016-02-03 10:59:35 CET
No different for me. How do I get a log?
Comment 5 Flip 2016-02-08 15:20:00 CET
Created attachment 228 [details]
Log from first start of Pulseview crashing on Android 6.0.1

Same problem here, sorry that the proposed solution does not work. I have gotten a much more detailed log from the very first start of pulseview. Also I wonder even though the QTLib Version  is 5.5.x in the Workspace, why ist there only 10kB difference in the output .apk?  Clear temporary data?
Comment 6 Flip 2016-02-08 15:28:18 CET
https://bugreports.qt.io/browse/QTBUG-48703

System error caused by this already solved Bug in QT < 5.6.0 RC

We should use a recent version of QT.  Doing a test Build right now but can't seem to get a sucessful run.
Comment 7 Flip 2016-02-08 16:26:53 CET
also confirmed on Android 5.0 on jfltexx
Comment 8 Uwe Hermann 2016-02-09 17:59:05 CET
Updated the APK to Qt 5.6-beta (and reverted a glib(mm) version bump which seems to cause problems), please retry.

The current APK is tested on my Android 4.4.2 tablet and PulseView starts up fine.
Comment 9 Flip 2016-02-09 19:55:55 CET
Created attachment 229 [details]
new log

Thank you for the fast update. A brief try was given and unfortunately pulseview still crashes while starting on any of my Android devices. ( all Android 5 or newer).
I am just scrolling through the log to check whats the problem. Qt startup is now without errors.
Comment 10 Flip 2016-02-09 20:09:15 CET
Created attachment 230 [details]
crash thombstone
Comment 11 Uwe Hermann 2016-02-16 20:25:57 CET
I bought an Android 5 and Android 6 device to test this, and I can confirm that the APK (which works fine on an Android 4.4.2 tablet) doesn't start on those.

Could be multiple issues here, but one of them is probably this:

I/AEE/AED ( 6563):     r0 00000000  r1 000019a0  r2 00000006  r3 00000000
I/AEE/AED ( 6563):     r4 a1d34db8  r5 00000006  r6 0000000d  r7 0000010c
I/AEE/AED ( 6563):     r8 a1d34800  r9 a1005630  sl a1d347d4  fp a1d346f4
I/AEE/AED ( 6563):     ip 000019a0  sp a1d34688  lr b6e228b1  pc b6e466dc  cpsr 600f0010
I/AEE/AED ( 6563): 
I/AEE/AED ( 6563): backtrace:
I/AEE/AED ( 6563):     #00 pc 0003b6dc  /system/lib/libc.so (tgkill+12)
I/AEE/AED ( 6563):     #01 pc 000178ad  /system/lib/libc.so (pthread_kill+52)
I/AEE/AED ( 6563):     #02 pc 000184c3  /system/lib/libc.so (raise+10)
I/AEE/AED ( 6563):     #03 pc 00014ca5  /system/lib/libc.so (__libc_android_abort+36)
I/AEE/AED ( 6563):     #04 pc 00013010  /system/lib/libc.so (abort+4)
I/AEE/AED ( 6563):     #05 pc 0008d41c  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (__gnu_cxx::__verbose_terminate_handler()+348)
I/AEE/AED ( 6563):     #06 pc 0003ea54  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (__cxxabiv1::__terminate(void (*)())+8)
I/AEE/AED ( 6563):     #07 pc 0003eb68  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (std::terminate()+12)
I/AEE/AED ( 6563):     #08 pc 0003ed40  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (__cxa_throw+156)
I/AEE/AED ( 6563):     #09 pc 00028c50  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (sigrok::check(int)+56)
I/AEE/AED ( 6563):     #10 pc 0002e26c  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (sigrok::Context::Context()+152)
I/AEE/AED ( 6563):     #11 pc 0002ec40  /data/app/org.sigrok.pulseview-1/lib/arm/libsigrokcxx.so (sigrok::Context::create()+20)
I/AEE/AED ( 6563):     #12 pc 000564f4  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (main+760)
I/AEE/AED ( 6563):     #13 pc 0001bf40  /data/data/org.sigrok.pulseview/qt-reserved-files/plugins/platforms/android/libqtforandroid.so (startMainMethod(void*)+292)
I/AEE/AED ( 6563):     #14 pc 00017037  /system/lib/libc.so (__pthread_start(void*)+30)
I/AEE/AED ( 6563):     #15 pc 00015007  /system/lib/libc.so (__start_thread+6)


Needs to be investigated.
Comment 12 Uwe Hermann 2016-03-10 17:44:58 CET
One possible reason for this issue on Android 5 and 6 could be this:
https://github.com/libusb/libusb/issues/58
Comment 13 Uwe Hermann 2016-10-20 23:06:37 CEST
*** Bug 856 has been marked as a duplicate of this bug. ***
Comment 14 Marcus Comstedt 2016-11-21 23:00:18 CET
I can report that on my Android 5 device (custom ROM, so the kernel config could be different from an OEM ROM) libusb _does_ work, but there are two other things that cause crashes:

* Qt crashes when creating the "android" style.  A workaround is to put a call to
  QApplication::setStyle("fusion"); before the Application object is created.
  No idea what's up with this; the crash happens in a destructor for a QMap
  containing style properties...

* libsigrok crashes because it doesn't check for a NULL return value from
  g_regex_new.  The NULL return is due to glib binding against the system
  libpcre.so, which is is compiled with the wrong flags (although so is ours,
  bizarrely enough...).  I have a fix for this, will push to github tomorrow.
Comment 15 Uwe Hermann 2016-11-25 11:43:24 CET
Thanks, the pcre fix is merged in f088bda16d97f4432c20b98d355e65baf4468f2c.
Comment 16 Uwe Hermann 2016-11-25 20:41:04 CET
And the respective sigrok-androidutils patch is merged in 995e06f35f8fae7370a286c44be86951632776d7, thanks!
Comment 17 Marcus Comstedt 2016-11-26 13:45:02 CET
Got another interresting crash, on 6 this time:

11-26 13:34:10.337   250   250 F DEBUG   : pid: 13082, tid: 13097, name: QtThread  >>> org.sigrok.pulseview <<<
11-26 13:34:10.337   250   250 F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x4f40084c
11-26 13:34:10.346   250   250 F DEBUG   :     r0 00000016  r1 00000206  r2 ffffffd0  r3 40556320
11-26 13:34:10.346   250   250 F DEBUG   :     r4 40556318  r5 4f61ca84  r6 42f2c000  r7 4f400000
11-26 13:34:10.346   250   250 F DEBUG   :     r8 42f1d508  r9 40549594  sl 00000001  fp 52c8efd4
11-26 13:34:10.346   250   250 F DEBUG   :     ip 4f400818  sp 52c8eef8  lr 4052ba2b  pc 40528aaa  cpsr 20030030
11-26 13:34:10.339   250   250 W debuggerd: type=1400 audit(0.0:13): avc: denied { search } for name="org.sigrok.pulseview" dev="sda32" ino=17049137 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
11-26 13:34:10.350   250   250 F DEBUG   : 
11-26 13:34:10.350   250   250 F DEBUG   : backtrace:
11-26 13:34:10.350   250   250 F DEBUG   :     #00 pc 00055aaa  /system/lib/libc.so (ifree+49)
11-26 13:34:10.350   250   250 F DEBUG   :     #01 pc 00058a27  /system/lib/libc.so (je_free+374)
11-26 13:34:10.350   250   250 F DEBUG   :     #02 pc 000a5ea0  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (pv::devices::HardwareDevice::display_name(pv::DeviceManager const&) const+1168)
11-26 13:34:10.350   250   250 F DEBUG   :     #03 pc 00069bdc  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (pv::DeviceManager::compare_devices(std::shared_ptr<pv::devices::Device>, std::shared_ptr<pv::devices::Device>)
11-26 13:34:10.350   250   250 F DEBUG   :     #04 pc 0006a1a8  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (void std::list<std::shared_ptr<pv::devices::HardwareDevice>, std::allocator<std::shared_ptr<pv::devices::HardwareDevice> > >::merge<std::_Bind<std::_Mem_fn<bool (pv::DeviceManager::*)(std::shared_ptr<pv::devices::Device>, std::shared_ptr<pv::devices::Device>)> (pv::DeviceManager*, std::_Placeholder<1>, std::_Placeholder<2>)> >(std::list<std::shared_ptr<pv::devices::HardwareDevice>, std::allocator<std::shared_ptr<pv::devices::HardwareDevice> > >&&, std::_Bind<std::_Mem_fn<bool (pv::DeviceManager::*)(std::shared_ptr<pv::devices::Device>, std::shared_ptr<pv::devices::Device>)> (pv::DeviceManager*, std::_Placeholder<1>, std::_Placeholder<2>)>)+168)
11-26 13:34:10.350   250   250 F DEBUG   :     #05 pc 0006a39c  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (void std::list<std::shared_ptr<pv::devices::HardwareDevice>, std::allocator<std::shared_ptr<pv::devices::HardwareDevice> > >::sort<std::_Bind<std::_Mem_fn<bool (pv::DeviceManager::*)(std::shared_ptr<pv::devices::Device>, std::shared_ptr<pv::devices::Device>)> (pv::DeviceManager*, std::_Placeholder<1>, std::_Placeholder<2>)> >(std::_Bind<std::_Mem_fn<bool (pv::DeviceManager::*)(std::shared_ptr<pv::devices::Device>, std::shared_ptr<pv::devices::Device>)> (pv::DeviceManager*, std::_Placeholder<1>, std::_Placeholder<2>)>)+184)
11-26 13:34:10.350   250   250 F DEBUG   :     #06 pc 0006e100  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (pv::DeviceManager::driver_scan(std::shared_ptr<sigrok::Driver>, std::map<sigrok::ConfigKey const*, Glib::VariantBase, std::less<sigrok::ConfigKey const*>, std::allocator<std::pair<sigrok::ConfigKey const* const, Glib::VariantBase> > >)+1324)
11-26 13:34:10.351   250   250 F DEBUG   :     #07 pc 0006e578  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (pv::DeviceManager::DeviceManager(std::shared_ptr<sigrok::Context>)+280)
11-26 13:34:10.351   250   250 F DEBUG   :     #08 pc 00065ff8  /data/app/org.sigrok.pulseview-2/lib/arm/libpulseview.so (main+1200)

(filtered through c++filt)

The call from display_name seems to be into the destructor of std::string.
Comment 18 Marcus Comstedt 2016-11-27 15:43:22 CET
Ok, tracked down this latest crash.  It happens when PV destroys an empty std::string which has been created by libsigrokcxx.  The reason is that PV contains it's own copy of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage because it is linked
against libgnustl_static.a, so when it compares that to what libsigrokcxx
(which uses the copy in libgnustl_shared.so) has created the addresses do
not match, and so it tries to free the statically allocated empty rep storage.

The fix is to link PV against libgnustl_shared.so as well.
Comment 19 Uwe Hermann 2016-12-03 20:08:40 CET
Thanks a lot!

Further fixes merged for sigrok-androidutil in 054991d3ec685bf80bd7ca5c2f4c54963f797952 and for sigrok-util in 4ac0f817523c61646aa4fa1948f6d0b455dde7af and c8cf030a21c58846a0e5a1d5f276599c709bf737.

Leaving the bug open for now until potential further issues seen on e.g. a Samsung Galaxy S7 with 6.0.1 have been investigated.
Comment 20 Uwe Hermann 2016-12-03 21:54:27 CET
Here's a new log from the 6.0.1 device were PulseView doesn't start atm:

F libc    : Invalid address 0xdcf73638 passed to free: value not allocated
F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 8406 (QtThread)
F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
F DEBUG   : Build fingerprint: 'samsung/heroltexx/herolte:6.0.1/xxxxx/xxxxxxxxxxxxxx:user/release-keys'
F DEBUG   : Revision: '8'
F DEBUG   : ABI: 'arm'
F DEBUG   : pid: 8361, tid: 8406, name: QtThread  >>> org.sigrok.pulseview <<<
F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
F DEBUG   : Abort message: 'Invalid address 0xdcf73638 passed to free: value not allocated'
F DEBUG   :     r0 00000000  r1 000020d6  r2 00000006  r3 db4bf978
F DEBUG   :     r4 db4bf980  r5 db4bf930  r6 00000000  r7 0000010c
F DEBUG   :     r8 e897e5c8  r9 f6d8c594  sl 00000001  fp db4befbc
F DEBUG   :     ip 00000006  sp db4bee60  lr f6d56365  pc f6d58754  cpsr 400f0010
F DEBUG   : 
F DEBUG   : backtrace:
F DEBUG   :     #00 pc 00042754  /system/lib/libc.so (tgkill+12)
F DEBUG   :     #01 pc 00040361  /system/lib/libc.so (pthread_kill+32)
F DEBUG   :     #02 pc 0001ca9b  /system/lib/libc.so (raise+10)
F DEBUG   :     #03 pc 00019d19  /system/lib/libc.so (__libc_android_abort+34)
F DEBUG   :     #04 pc 0001755c  /system/lib/libc.so (abort+4)
F DEBUG   :     #05 pc 0001b6af  /system/lib/libc.so (__libc_fatal+16)
F DEBUG   :     #06 pc 00055b73  /system/lib/libc.so (ifree+202)
F DEBUG   :     #07 pc 00058a57  /system/lib/libc.so (je_free+374)
F DEBUG   :     #08 pc 000a0d3c  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::devices::HardwareDevice::display_name(pv::DeviceManager const&) const+1184)
F DEBUG   :     #09 pc 000f45d0  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::widgets::DeviceToolButton::update_device_list()+684)
F DEBUG   :     #10 pc 000f4fd4  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (_ZN2pv7widgets16DeviceToolButton15set_device_listERKSt4listISt10shared_ptrINS_7devices6DeviceEESaIS6_EES6

F DEBUG   :     #11 pc 000b0bd0  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::toolbars::MainBar::update_device_list()+256)
F DEBUG   :     #12 pc 000b3394  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::toolbars::MainBar::MainBar(pv::Session&, pv::MainWindow&)+6348)
F DEBUG   :     #13 pc 0006cfe0  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::MainWindow::add_view(QString const&, pv::view::ViewType, pv::Session&)+1324)
F DEBUG   :     #14 pc 0006d6a4  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::MainWindow::add_session()+568)
F DEBUG   :     #15 pc 00078eec  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (pv::MainWindow::MainWindow(pv::DeviceManager&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, QWidget*)+280)
F DEBUG   :     #16 pc 00061858  /data/app/org.sigrok.pulseview-1/lib/arm/libpulseview.so (main+1044)
F DEBUG   :     #17 pc 0001cd1c  /data/data/org.sigrok.pulseview/qt-reserved-files/plugins/platforms/android/libqtforandroid.so (startMainMethod(void*)+292)
F DEBUG   :     #18 pc 0003fc63  /system/lib/libc.so (__pthread_start(void*)+30)
F DEBUG   :     #19 pc 0001a39b  /system/lib/libc.so (__start_thread+6)
F DEBUG   : 
F DEBUG   : Tombstone written to: /data/tombstones/tombstone_05
E DEBUG   : AM write failed: Broken pipe
E         : ro.product_ship = true
E         : ro.debug_level = 0x4f4c
E         : sys.mobilecare.preload = false
D InputDispatcher: Focused application set to: xxxx
I BootReceiver: Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
W ActivityManager:   Force finishing activity org.sigrok.pulseview/.PulseViewActivity
Comment 21 Uwe Hermann 2016-12-17 17:05:30 CET
And the last part of this bug was "fixed" in sigrok-util in a4c5908972c114c7c9608e599fe2ea05ec5db501.

For reasons that are not yet entirely known, using the prebuilt toolchains instead of the ones created by the NDK's make-standalone-toolchain.sh results in the following difference (which fixes the APK on Android 5 + 6 far enough that the app now can successfully start; any further issues should be separate bugs):

$ nm -C old/lib/armeabi/libsigrokcxx.so | grep empty_rep_storage
000bc648 b std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_S_empty_rep_storage
000bc638 b std::string::_Rep::_S_empty_rep_storage

$ nm -C new/lib/armeabi/libsigrokcxx.so | grep empty_rep_storage
         U std::string::_Rep::_S_empty_rep_storage
Comment 22 majenko 2017-04-17 13:48:18 CEST
I am still getting the issue with the latest nightly build. Instance crash at startup on Marshmallow. Has this 'fix' actually made its way into the Jenkins build system yet, or is it still not publicly available?
Comment 23 majenko 2017-04-17 13:51:16 CEST
That is, SM-T555 with 6.0.1. I wish I knew how to get a crash log out of this...
Comment 24 Uwe Hermann 2017-04-19 23:08:18 CEST
Hi, the fix was merged and made it into Jenkins and it did work in the past, yes.

This must be some new regression in either the build setup (dependency libs or such) or in PulseView itself. I can reproduce the issue here as well, and have opened bug #932 for this. Thanks for the report! I'll see if I can bisect this to find out when exactly it broke.