50ButtonsEach / fliclib-linux-dist

114 stars 19 forks source link

OSMC: terminate called without an active exception #22

Closed pfink closed 8 years ago

pfink commented 8 years ago

Hi all,

I tried to build and run the Flic Linux SDK on the newest version of OSMC which is based on Debian Jessie. I followed CheapB's guide (except of installing AdaFruit IDE). Bluez is installed by default on OSMC and when I try to uninstall I run into dependency issues, so I just kept the built-in bluez and stopped it by running

service bluetooth stop

and started the latest version of bluez I downloaded and compiled as described within the guide

sudo ./bluetoothd -nEd

But when I run

sudo ./daemon -l -f flic.sqlite3

the daemon exits without any error message. Full log of flic daemon:

Successfully created D-Bus connection
Successfully created D-Bus object manager
Manager: checkObjects
Manager: new adapter, 00:1A:7D:DA:71:12
Adapter: setProxies
Successfully registered profile
Successfully watching D-Bus
pure virtual method called
terminate called without an active exception

Excerpt of bluetoothd:

bluetoothd[707]: src/gatt-database.c:manager_register_profile() sender :1.27
bluetoothd[707]: src/gatt-database.c:profile_add() Added ":1.27/org/flic/00_1A_7D_DA_71_12/f02adfc0-26e7-11e4-9edc-0002a5d5c51b"
bluetoothd[707]: src/gatt-database.c:profile_exited() ":1.27" exited
bluetoothd[707]: src/gatt-database.c:profile_remove() Removed ":1.27/org/flic/00_1A_7D_DA_71_12/f02adfc0-26e7-11e4-9edc-0002a5d5c51b"
fabianbergmark commented 8 years ago

Hi

That's weird. Something is problematic with the daemon program. Could you run

valgrind ./daemon -l -f flic.sqlite3

and email the output to fabian@shortcutlabs.com

pfink commented 8 years ago

Forgot to mention: My device is Raspberry Pi 2. Checked it with armv6l and armv7l. Here's the output of armv6l (which is almost the same as armv7l except of memory addresses and number of bytes in the summary) . I'll also send via mail. If you have a RPI 2 let me know and I'll share the complete SD card image with you (but if you need to reproduce, you'll probably faster to take a fresh image from the OSMC web site and installing bluez and flic on your own).

==737== Memcheck, a memory error detector
==737== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==737== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==737== Command: ./daemon -l -f flic.sqlite3
==737==
==737== Invalid read of size 4
==737==    at 0x485AABC: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x5040048 is 16 bytes inside a block of size 19 alloc'd
==737==    at 0x483EA1C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485AA90: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x5041ed0 is 24 bytes inside a block of size 31 alloc'd
==737==    at 0x483EA1C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x485AA2C: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x507b7e8 is 40 bytes inside a block of size 42 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
Successfully created D-Bus connection
==737== Invalid read of size 4
==737==    at 0x485AB48: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x5098c9c is 12 bytes inside a block of size 15 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485AA78: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x509b264 is 28 bytes inside a block of size 35 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485A8B0: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x509b264 is 28 bytes inside a block of size 35 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485AA18: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x509ca5c is 4 bytes inside a block of size 9 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485A9E8: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50a005c is 28 bytes inside a block of size 34 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x485A79C: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50a02e4 is 28 bytes inside a block of size 30 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485AA00: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50a04ec is 12 bytes inside a block of size 18 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
Successfully created D-Bus object manager
Manager: checkObjects
==737== Invalid read of size 8
==737==    at 0x485AAA8: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50d8b4c is 20 bytes inside a block of size 27 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x485A8F4: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50f71ac is 28 bytes inside a block of size 31 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x485A644: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50f7308 is 32 bytes inside a block of size 34 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
Manager: new adapter, 00:1A:7D:DA:71:12
Adapter: setProxies
==737== Invalid read of size 8
==737==    at 0x485A770: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x510e4f4 is 12 bytes inside a block of size 19 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485AB1C: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x510e4f4 is 12 bytes inside a block of size 19 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 8
==737==    at 0x485A574: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x510e970 is 8 bytes inside a block of size 15 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x485A6A8: ??? (in /usr/lib/libarmmem.so)
==737==  Address 0x50bc020 is 0 bytes inside a block of size 3 alloc'd
==737==    at 0x483E394: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
Successfully registered profile
Successfully watching D-Bus
==737== Thread 3:
==737== Invalid read of size 4
==737==    at 0x4C91104: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20)
==737==  Address 0x512176c is 36 bytes inside a block of size 52 free'd
==737==    at 0x483FF74: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid read of size 4
==737==    at 0x4C9110C: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20)
==737==  Address 0x5121774 is 44 bytes inside a block of size 52 free'd
==737==    at 0x483FF74: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid write of size 4
==737==    at 0x4C9110E: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20)
==737==  Address 0x5121770 is 40 bytes inside a block of size 52 free'd
==737==    at 0x483FF74: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
==737== Invalid write of size 4
==737==    at 0x4C91112: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20)
==737==  Address 0x5121774 is 44 bytes inside a block of size 52 free'd
==737==    at 0x483FF74: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==737==
pure virtual method called
terminate called without an active exception
==737==
==737== HEAP SUMMARY:
==737==     in use at exit: 184,009 bytes in 2,360 blocks
==737==   total heap usage: 10,632 allocs, 8,272 frees, 462,142 bytes allocated
==737==
==737== LEAK SUMMARY:
==737==    definitely lost: 28 bytes in 2 blocks
==737==    indirectly lost: 24 bytes in 2 blocks
==737==      possibly lost: 87,133 bytes in 419 blocks
==737==    still reachable: 87,012 bytes in 1,822 blocks
==737==         suppressed: 0 bytes in 0 blocks
==737== Rerun with --leak-check=full to see details of leaked memory
==737==
==737== For counts of detected and suppressed errors, rerun with: -v
==737== ERROR SUMMARY: 35 errors from 21 contexts (suppressed: 0 from 0)
Killed
fabianbergmark commented 8 years ago

Weird that you are the first to report this, as it should be an obvious C++ bug. I'll take a quick peek at the code tomorrow. Thanks for the report

pfink commented 8 years ago

I don't know, I also tested it on a plain Jessie Image - it works fine there... So something has to be different with OSMC.

ryanshuck commented 8 years ago

I just had this happen on Jessie on the BeagleBone Black, also tried armv6l and armv7l.

ryanshuck commented 8 years ago

Beaglebone Black Rev. C - Wanted to update my comment. I did a fresh build of Jessie, updated everything, got bluez 5.37 to compile, and got this same error again. Below is my valgrind output as suggested above. Don't know if this will help at all, but I figured it was worth a try. armv7l output is first, armv6l is second here.

root@beaglebone:~/fliclib-linux/armv7l# valgrind ./daemon -l -f flic.sqlite3 ==5841== Memcheck, a memory error detector ==5841== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==5841== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==5841== Command: ./daemon -l -f flic.sqlite3 ==5841== Successfully created D-Bus connection Successfully created D-Bus object manager Manager: checkObjects Successfully watching D-Bus ==5841== Thread 3: ==5841== Invalid read of size 4 ==5841== at 0x4C3B104: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==5841== Address 0x50d981c is 36 bytes inside a block of size 52 free'd ==5841== at 0x483FF74: operator delete(void_) (vg_replacemalloc.c:507) ==5841== by 0x3C477: ??? (in /root/fliclib-linux/armv7l/daemon) ==5841== ==5841== Invalid read of size 4 ==5841== at 0x4C3B10C: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==5841== Address 0x50d9824 is 44 bytes inside a block of size 52 free'd ==5841== at 0x483FF74: operator delete(void) (vg_replacemalloc.c:507) ==5841== by 0x3C477: ??? (in /root/fliclib-linux/armv7l/daemon) ==5841== ==5841== Invalid write of size 4 ==5841== at 0x4C3B10E: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==5841== Address 0x50d9820 is 40 bytes inside a block of size 52 free'd ==5841== at 0x483FF74: operator delete(void) (vg_replacemalloc.c:507) ==5841== by 0x3C477: ??? (in /root/fliclib-linux/armv7l/daemon) ==5841== ==5841== Invalid write of size 4 ==5841== at 0x4C3B112: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==5841== Address 0x50d9824 is 44 bytes inside a block of size 52 free'd ==5841== at 0x483FF74: operator delete(void) (vg_replace_malloc.c:507) ==5841== by 0x3C477: ??? (in /root/fliclib-linux/armv7l/daemon) ==5841== pure virtual method called terminate called without an active exception ==5841== ==5841== HEAP SUMMARY: ==5841== in use at exit: 172,008 bytes in 2,043 blocks ==5841== total heap usage: 7,022 allocs, 4,979 frees, 354,835 bytes allocated ==5841== ==5841== LEAK SUMMARY: ==5841== definitely lost: 12 bytes in 1 blocks ==5841== indirectly lost: 12 bytes in 1 blocks ==5841== possibly lost: 86,799 bytes in 407 blocks ==5841== still reachable: 76,433 bytes in 1,531 blocks ==5841== suppressed: 0 bytes in 0 blocks ==5841== Rerun with --leak-check=full to see details of leaked memory ==5841== ==5841== For counts of detected and suppressed errors, rerun with: -v ==5841== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) Killed

root@beaglebone:~/fliclib-linux/armv6l# ./daemon -l -f flic.sqlite3 Successfully created D-Bus connection Successfully created D-Bus object manager Manager: checkObjects Successfully watching D-Bus pure virtual method called terminate called without an active exception Aborted root@beaglebone:~/fliclib-linux/armv6l# valgrind ./daemon -l -f flic.sqlite3 ==6835== Memcheck, a memory error detector ==6835== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==6835== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==6835== Command: ./daemon -l -f flic.sqlite3 ==6835== Successfully created D-Bus connection Successfully created D-Bus object manager Manager: checkObjects Successfully watching D-Bus ==6835== Thread 3: ==6835== Invalid read of size 4 ==6835== at 0x4C90104: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==6835== Address 0x50d8f94 is 36 bytes inside a block of size 52 free'd ==6835== at 0x483FF74: operator delete(void_) (vg_replacemalloc.c:507) ==6835== by 0x3C49F: ??? (in /root/fliclib-linux/armv6l/daemon) ==6835== ==6835== Invalid read of size 4 ==6835== at 0x4C9010C: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==6835== Address 0x50d8f9c is 44 bytes inside a block of size 52 free'd ==6835== at 0x483FF74: operator delete(void) (vg_replacemalloc.c:507) ==6835== by 0x3C49F: ??? (in /root/fliclib-linux/armv6l/daemon) ==6835== ==6835== Invalid write of size 4 ==6835== at 0x4C9010E: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==6835== Address 0x50d8f98 is 40 bytes inside a block of size 52 free'd ==6835== at 0x483FF74: operator delete(void) (vg_replacemalloc.c:507) ==6835== by 0x3C49F: ??? (in /root/fliclib-linux/armv6l/daemon) ==6835== ==6835== Invalid write of size 4 ==6835== at 0x4C90112: ??? (in /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.20) ==6835== Address 0x50d8f9c is 44 bytes inside a block of size 52 free'd ==6835== at 0x483FF74: operator delete(void) (vg_replace_malloc.c:507) ==6835== by 0x3C49F: ??? (in /root/fliclib-linux/armv6l/daemon) ==6835== pure virtual method called terminate called without an active exception ==6835== ==6835== HEAP SUMMARY: ==6835== in use at exit: 172,008 bytes in 2,043 blocks ==6835== total heap usage: 6,996 allocs, 4,953 frees, 354,088 bytes allocated ==6835== ==6835== LEAK SUMMARY: ==6835== definitely lost: 12 bytes in 1 blocks ==6835== indirectly lost: 12 bytes in 1 blocks ==6835== possibly lost: 86,799 bytes in 407 blocks ==6835== still reachable: 76,433 bytes in 1,531 blocks ==6835== suppressed: 0 bytes in 0 blocks ==6835== Rerun with --leak-check=full to see details of leaked memory ==6835== ==6835== For counts of detected and suppressed errors, rerun with: -v ==6835== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) Killed

pfink commented 8 years ago

@fabianbergmark: Investigating the issue with @badaix and @samnazarko (see linked issues above), it's caused because OSMC uses upstream libs. That means fliclib sources have to be build statically to ensure portability to other distros like OSMC. As sources aren't published atm, we need your help! Could you provide a statically linked binary?

fabianbergmark commented 8 years ago

The first builds of this library was static, but it caused all kinds of trouble, especially with glib. I might need to investigate more to see if these issues can be solved

pfink commented 8 years ago

As we successfully investigated the cause of the issue it's clear that some distributions and devices are currently just not supported because static linked builds are not possible atm due to other reasons. So I'm closing this in favour of an issue I newly created that gives a cleaner summary to new users: #33

I'd suggest if other users experience problems similar to this one, than we can use issue #33 shortly document which distributions and devices are affected.