Question

I'm using Android iBeacon Library from Radius Networks to play with iBeacons. After some time I see constantly alerts popping out of the blue: "Unfortunately, Bluetooth Share has stopped." with [Report] [OK] buttons.

Phone: Nexus 5 with Android 4.4.2.

That's a bummer since Nexus 5 is currently top Android phone and using iBeacons seems not working after some time. That means that iBeacons cannot be used in production as Bluetooth LE does not work properly on Android (even on the newest release).

Only factory reset seems to fix the problem and I cannot ask users of my app to do so :/.

Logcat:

I/DEBUG   (  175): Build fingerprint: 'google/hammerhead/hammerhead:4.4.2/KOT49H/937116:user/release-keys'
I/DEBUG   (  175): Revision: '11'
I/DEBUG   (  175): pid: 5062, tid: 5085, name: BTIF  >>> com.android.bluetooth <<<
I/DEBUG   (  175): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG   (  175):     r0 ffffffff  r1 00007d00  r2 00007c60  r3 74ddc308
I/DEBUG   (  175):     r4 74ddc318  r5 00000000  r6 7568ea60  r7 7512d595
I/DEBUG   (  175):     r8 00000002  r9 7568ea54  sl 751638cd  fp 00000004
I/DEBUG   (  175):     ip 00000000  sp 7568ea10  lr 750ad68d  pc 750ad6b0  cpsr 600f0030
I/DEBUG   (  175):     d0  000000000000000f  d1  746f6d65725f6464
I/DEBUG   (  175):     d2  000000cc00000069  d3  754bde5000000066
I/DEBUG   (  175):     d4  0034003a00440045  d5  00390033003a0033
I/DEBUG   (  175):     d6  003a00370038003a  d7  0030003a00380034
I/DEBUG   (  175):     d8  0000000000000000  d9  0000000000000000
I/DEBUG   (  175):     d10 0000000000000000  d11 0000000000000000
I/DEBUG   (  175):     d12 0000000000000000  d13 0000000000000000
I/DEBUG   (  175):     d14 0000000000000000  d15 0000000000000000
I/DEBUG   (  175):     d16 3fe8000000000000  d17 3fc999999999999a
I/DEBUG   (  175):     d18 0000000000000000  d19 0000000000000000
I/DEBUG   (  175):     d20 0000000000000000  d21 0000004400000044
I/DEBUG   (  175):     d22 0000000000000000  d23 0000000000000000
I/DEBUG   (  175):     d24 0000000000000000  d25 0002a7600002a760
I/DEBUG   (  175):     d26 0707070703030303  d27 0300000004000000
I/DEBUG   (  175):     d28 0800000009000000  d29 0001000000010000
I/DEBUG   (  175):     d30 010b400001088000  d31 01108000010e0000
I/DEBUG   (  175):     scr 60000010
I/DEBUG   (  175): 
I/DEBUG   (  175): backtrace:
I/DEBUG   (  175):     #00  pc 0004e6b0  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):     #01  pc 0004ea89  /system/lib/hw/bluetooth.default.so (btif_config_set+156)
I/DEBUG   (  175):     #02  pc 0004eb91  /system/lib/hw/bluetooth.default.so (btif_config_set_int+20)
I/DEBUG   (  175):     #03  pc 000345cd  /system/lib/hw/bluetooth.default.so (btif_storage_set_remote_addr_type+36)
I/DEBUG   (  175):     #04  pc 0004adbd  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):     #05  pc 0002f091  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):     #06  pc 000553bd  /system/lib/hw/bluetooth.default.so (gki_task_entry+92)
I/DEBUG   (  175):     #07  pc 0000d170  /system/lib/libc.so (__thread_entry+72)
I/DEBUG   (  175):     #08  pc 0000d308  /system/lib/libc.so (pthread_create+240)
I/DEBUG   (  175): 
I/DEBUG   (  175): stack:
I/DEBUG   (  175):          7568e9d0  00000000  
I/DEBUG   (  175):          7568e9d4  4156f52d  /system/lib/libdvm.so
I/DEBUG   (  175):          7568e9d8  00004000  
I/DEBUG   (  175):          7568e9dc  7568ea71  [stack:5085]
I/DEBUG   (  175):          7568e9e0  415d70d0  
I/DEBUG   (  175):          7568e9e4  7fffffee  
I/DEBUG   (  175):          7568e9e8  75587bd0  [anon:libc_malloc]
I/DEBUG   (  175):          7568e9ec  000007c6  
I/DEBUG   (  175):          7568e9f0  74ddc318  [anon:libc_malloc]
I/DEBUG   (  175):          7568e9f4  00007c60  
I/DEBUG   (  175):          7568e9f8  00007c60  
I/DEBUG   (  175):          7568e9fc  74ddc308  [anon:libc_malloc]
I/DEBUG   (  175):          7568ea00  74ddc318  [anon:libc_malloc]
I/DEBUG   (  175):          7568ea04  000007c6  
I/DEBUG   (  175):          7568ea08  7568ea60  [stack:5085]
I/DEBUG   (  175):          7568ea0c  750ad68d  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):     #00  7568ea10  00000041  
I/DEBUG   (  175):          7568ea14  7512f561  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):          7568ea18  7568ea60  [stack:5085]
I/DEBUG   (  175):          7568ea1c  750ada8d  /system/lib/hw/bluetooth.default.so (btif_config_set+160)
I/DEBUG   (  175):     #01  7568ea20  7568ea54  [stack:5085]
I/DEBUG   (  175):          7568ea24  7568ea54  [stack:5085]
I/DEBUG   (  175):          7568ea28  00000001  
I/DEBUG   (  175):          7568ea2c  00000001  
I/DEBUG   (  175):          7568ea30  764b890a  [anon:libc_malloc]
I/DEBUG   (  175):          7568ea34  40146384  
I/DEBUG   (  175):          7568ea38  7516ea94  
I/DEBUG   (  175):          7568ea3c  00000007  
I/DEBUG   (  175):          7568ea40  7512dff5  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):          7568ea44  750adb95  /system/lib/hw/bluetooth.default.so (btif_config_set_int+24)
I/DEBUG   (  175):     #02  7568ea48  00000004  
I/DEBUG   (  175):          7568ea4c  00000002  
I/DEBUG   (  175):          7568ea50  7512f561  /system/lib/hw/bluetooth.default.so
I/DEBUG   (  175):          7568ea54  00000001  
I/DEBUG   (  175):          7568ea58  40146384  
I/DEBUG   (  175):          7568ea5c  750935d1  /system/lib/hw/bluetooth.default.so (btif_storage_set_remote_addr_type+40)
Was it helpful?

Solution

EDIT: There is now a partial solution for this here.

The good news is that this low-level Android bug largely affects developers or people who work in Bluetooth dev shops who have been around a large number of Bluetooth devices in the same place. Going to a BLE or iBeacon hackathon will almost certainly a trigger it. Fortunately, most end users of our apps do not do this.

The bug is triggered when an internal buffer holding recently scanned Bluetooth LE Mac addresses fills up. After it fills, scanning a new Bluetooth LE device will cause Android's Bluetooth service to crash and restart itself. The dialog you see is from Android's Bluetooth Share service, which dies not cleanly handle the restart of the Bluetooth Service restart and crashes itself. Here is the Android bug report.

The bug can affect any app or library that does Bluetooth LE scanning, or looks for iBeacons, not just the Android iBeacon Library. But again, not all users will experience it. I work at Radius Networks where we have dozens of Bluetooth LE devices transmitting all the time, and it took four months before I ever saw that dialog on my Nexus 4 -- it only came up two weeks ago. Since then, I have been working to characterize the problem and find workarounds.

I have been able to clear the condition simply by going into Airplane Mode for a few seconds then coming out. This, however is not a permenant fix, as overflowing Android's buffer again will cause it to return. We are still researching more automated solutions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top