Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scanning large number of BLE Tags

I was looking for a possibility to scan a large number of BLE Tags (StickNFind) in a single scan. I have noticed that when I scan for 10 seconds I can detect around 20 BLEs easily. When I increase the scanning interval to around 30 seconds and try to scan a large number of BLE Tags e.g. 200 Tags, I see an error in the LogCat about buffer overflow (GKI_exception). This problem occurs somewhere in the core Android libraries, which I am unable to debug. The exact error log is attached.

11-27 11:39:30.542: D/dalvikvm(1017): GC_CONCURRENT freed 412K, 8% free 9039K/9760K, paused 1ms+1ms, total 16ms
11-27 11:39:30.552: D/BtGatt.GattService(1017): onScanResult() - address=E8:C6:AD:6F:BC:22, rssi=-76
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=10
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n96 len=3 dev_type=2
11-27 11:39:30.552: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.592: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.592: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.602: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.GattService(1017): onScanResult() - address=F7:09:63:BC:66:D0, rssi=-78
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=11
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.602: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.672: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:D0, rssi=-86
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=12
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.672: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.712: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.732: D/dalvikvm(1017): GC_CONCURRENT freed 385K, 8% free 9038K/9760K, paused 7ms+1ms, total 20ms
11-27 11:39:30.742: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:35, rssi=-94
11-27 11:39:30.742: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=13
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n8B len=3 dev_type=2
11-27 11:39:30.772: D/BtGatt.GattService(1017): onScanResult() - address=FC:A6:B0:A0:32:B6, rssi=-73
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.772: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=14
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:C2, rssi=-76
11-27 11:39:30.802: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=15
11-27 11:39:30.812: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:2D, rssi=-76
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=16
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=s8E len=3 dev_type=2
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.902: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.902: D/dalvikvm(1017): GC_CONCURRENT freed 480K, 8% free 9038K/9760K, paused 2ms+2ms, total 20ms

What could be the reason for such problem and how can I resolve it?

Thanks in advance!

like image 374
Shuja Jamil Avatar asked Dec 04 '13 07:12

Shuja Jamil


People also ask

How do I scan a BLE device?

To find BLE devices, you use the startScan() method. This method takes a ScanCallback as a parameter. You must implement this callback, because that is how scan results are returned.

What is scan interval in BLE?

Scan Interval. 30 ms to 60 ms. Scan Window. 30 ms. After 30 seconds (reduced power)

What is Bluetooth low energy in Android?

Bluetooth Low Energy (BLE), available in Android 4.3 and later, creates short connections between devices to transfer bursts of data. BLE remains in sleep mode when not connected. This lets BLE provide lower bandwidth and reduced power consumption compared to Classic Bluetooth.


1 Answers

I think there's no way to completely fix this issue on our side, but one thing you can do to decrease the likelihood of this error occurring is to do as few work as possible in the onLeScan-callback. It's called from a dedicated bluetooth-thread inside the system. From my experience, the error you mentioned occurs more often if you do a lot of work inside this callback / thread.

EDIT: I filed a bug report for this: https://code.google.com/p/android/issues/detail?id=65455

like image 174
TomTasche Avatar answered Sep 20 '22 16:09

TomTasche