innoveit / react-native-ble-manager

React Native BLE communication module
http://innoveit.github.io/react-native-ble-manager/
Apache License 2.0
2.13k stars 764 forks source link

NullPointerException: Attempt to invoke interface method #882

Closed Burzo closed 11 months ago

Burzo commented 2 years ago

Describe the bug

The following error is reported in Crashlytics for some of our users:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference
       at it.innove.Peripheral$6.run(Peripheral.java:666)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8204)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)

To Reproduce I've never encountered this during development as far as I remember, so I'm not sure how to reproduce this.

Smartphones that reported this:

Additional context I wish I had more information to give, but I'm afraid this is all I know at the moment.

at it.innove.Peripheral$6.run(Peripheral.java:666)

This line is the only indicator that I noticed.

Hopefully someone can help out.

Burzo commented 2 years ago

This issue now also occurred during development as well, immediately after scanning stopped, but I can't seem to reproduce it. I got the Android logcat though:

08-08 09:49:00.010 16033 16052 I AiAiEcho: Predicting[1]: { Feature:1, creation:2022-08-08T07:37:12.276Z, expiry:2022-08-08T13:37:12.276Z, isExpired: false}
08-08 09:49:00.012 16033 16052 I AiAiEcho: Ranked targets strategy: WEIGHTED, count: 1, ranking metadata: { cardId: WEATHER-569377242, card type: 1, update time: 2022-08-08T07:37:12.276Z, expiration time: 2022-08-08T13:37:12.276Z, ranking metadata: RankingMetaData(urgency=0.966, priority=0.3, recency=1.0, rankScore=0.28980002, importantTimePoints=# mak@7bca4) }
08-08 09:49:00.014 16033 16052 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface lockscreen with targets# 1
08-08 09:49:00.016 16033 16052 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface home with targets# 1
08-08 09:49:00.016 16033 16052 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface media_data_manager with targets# 0
08-08 09:49:00.020 18459 18459 W BcSmartspaceCard: No title view to update
08-08 09:49:00.026  1804  1804 W BcSmartspaceCard: No title view to update
08-08 09:49:00.038 17671 17716 D ReactNativeBleManager: onCharacteristicChanged: 74636C765F726571756573742035313030303030 from peripheral: CB:39:6B:B8:0D:23
08-08 09:49:00.083 17671 17716 D ReactNativeBleManager: onCharacteristicChanged: 300D0A74636C765F726573706F6E736520353130 from peripheral: CB:39:6B:B8:0D:23
08-08 09:49:00.129 17671 17716 D ReactNativeBleManager: onCharacteristicChanged: 303030303430313030303030300D0D0A3E200A from peripheral: CB:39:6B:B8:0D:23
08-08 09:49:00.189 17671 17781 D ReactNativeBleManager: Write without response to: CD:17:25:BA:A8:8E
08-08 09:49:00.189 17671 17781 D ReactNativeBleManager: Message(23): 74636C765F726571756573742035313030303030300D0A
08-08 09:49:00.191 17671 17716 D ReactNativeBleManager: Command queue empty
08-08 09:49:00.201 17671 17716 D ReactNativeBleManager: Command queue empty
08-08 09:49:00.238 17671 17780 I ReactNativeJS: Written tclv_request 51000000 to the device 1e002700-1850-4b35-4338-362000000000 (09:49:00-238)
08-08 09:49:00.299 17671 17716 D ReactNativeBleManager: onCharacteristicChanged: 74636C765F726571756573742035313030303030 from peripheral: CD:17:25:BA:A8:8E
08-08 09:49:00.300 17671 17716 D ReactNativeBleManager: onCharacteristicChanged: 300D0A74636C765F726573706F6E736520353130 from peripheral: CD:17:25:BA:A8:8E
08-08 09:49:00.309   740  2274 W bthal.bqr: ParseLinkQualityRelatedEvt: Appro LSTO , Handle: 0x0043, RSSI_C0: -66, RSSI_C1: -75, TxPw_C0: -128, ReTxPw_C0: -128, TxPw_C1: 9, ReTxPw_C1: 9, BFTx: 0x01, BFReTx: 0x01, DivTx: 0x01, DivReTx: 0x01
08-08 09:49:00.309   740  2274 I bthal.flowcontrol: HciEventPreProcess: HCI Event 0xff Opcode 0 Length 225 unhandled by debug_VendorEvent
08-08 09:49:00.310  1788  2603 W bt_stack: [WARNING:btif_bqr.cc(390)] Appro LSTO , Handle: 0x0043, DH1, Central, PwLv: 9, RSSI: -66, SNR: 0, UnusedCh: 25, UnidealCh: 0, ReTx: 55, NoRX: 55, NAK: 0, FlowOff: 0, OverFlow: 0, UndFlow: 0
08-08 09:49:00.310  1788  2603 I bt_stack: [INFO:btsnoop.cc(338)] clear_l2cap_allowlist: Clearing acceptlist from l2cap channel. conn_handle=67 cid=4:4
08-08 09:49:00.310  1788  2603 W bluetooth: system/bt/stack/gatt/gatt_attr.cc:493 gatt_disc_cmpl_cback: Gatt discovery completed with errors status:133
08-08 09:49:00.310  1788  2603 I bluetooth: system/bt/stack/gap/gap_ble.cc:298 client_connect_cback: No active GAP service found for peer:xx:xx:xx:xx:09:12 callback:Disconnected
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:3 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:4 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:5 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:6 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:7 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:8 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:9 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:10 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:11 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:12 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:13 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 I bt_bta_gattc: system/bt/bta/gatt/bta_gattc_act.cc:1115 bta_gattc_conn_cback: Disconnected att_id:14 transport:le reason:GATT_CONN_TIMEOUT
08-08 09:49:00.310  1788  2603 W bt_btm_sec: system/bt/stack/btm/btm_sec.cc:3685 btm_sec_disconnected: Got uncommon disconnection reason:Connection Timeout handle:0x0043
08-08 09:49:00.311  1788  2603 I btif_av : system/bt/btif/src/btif_av.cc:3352 btif_av_acl_disconnected: btif_av_acl_disconnected: Peer f8:12:82:78:09:12 : ACL Disconnected
08-08 09:49:00.312 17671 17671 D AndroidRuntime: Shutting down VM
--------- beginning of crash
08-08 09:49:00.313 17671 17671 E AndroidRuntime: FATAL EXCEPTION: main
08-08 09:49:00.313 17671 17671 E AndroidRuntime: Process: com.myapp, PID: 17671
08-08 09:49:00.313 17671 17671 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at it.innove.Peripheral$6.run(Peripheral.java:666)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:938)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:201)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:288)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7870)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
08-08 09:49:00.313 17671 17671 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
08-08 09:49:00.313 17671 17716 D BluetoothGatt: onClientConnectionState() - status=0 clientIf=14 device=F8:12:82:78:09:12
08-08 09:49:00.313 17671 17716 D ReactNativeBleManager: onConnectionStateChange to 0 on peripheral: F8:12:82:78:09:12 with status 0
08-08 09:49:00.313  1788  2603 I btif_av : system/bt/btif/src/btif_av.cc:1078 FindOrCreatePeer: BtifAvPeer *BtifAvSource::FindOrCreatePeer(const RawAddress &, tBTA_AV_HNDL): Create peer: peer_address=f8:12:82:78:09:12 bta_handle=0x41 peer_id=0
08-08 09:49:00.313  1788  2603 I btif_av : system/bt/btif/src/btif_av.cc:3279 btif_av_get_peer_sep: No active sink or source peer found
08-08 09:49:00.313  1788  2603 I bt_btif_a2dp_source: system/bt/btif/src/btif_a2dp_source.cc:691 btif_a2dp_source_on_idle: btif_a2dp_source_on_idle: state=STATE_OFF
08-08 09:49:00.313  1788  2603 I btif_av : system/bt/btif/src/btif_av.cc:3279 btif_av_get_peer_sep: No active sink or source peer found
08-08 09:49:00.313  1788  2603 I bt_btif_a2dp_source: system/bt/btif/src/btif_a2dp_source.cc:691 btif_a2dp_source_on_idle: btif_a2dp_source_on_idle: state=STATE_OFF
08-08 09:49:00.313  1788  2603 I btif_av : system/bt/btif/src/btif_av.cc:1123 DeleteIdlePeers: DeleteIdlePeers: Deleting idle peer: f8:12:82:78:09:12 bta_handle=0x41
08-08 09:49:00.313 17671 17716 D BluetoothGatt: cancelOpen() - device: F8:12:82:78:09:12
08-08 09:49:00.316 17671 17716 D BluetoothGatt: close()
08-08 09:49:00.316 17671 17716 D BluetoothGatt: unregisterApp() - mClientIf=14
08-08 09:49:00.317  1549 18672 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
08-08 09:49:00.318  1549  3353 W ActivityTaskManager:   Force finishing activity com.myapp/.MainActivity
08-08 09:49:00.318 17671 17716 D ReactNativeBleManager: Peripheral event (BleManagerDisconnectPeripheral):F8:12:82:78:09:12
08-08 09:49:00.318 17671 17716 D ReactNativeBleManager: Disconnect
08-08 09:49:00.329  1788  2603 E bt_stack: [ERROR:bta_gattc_act.cc(298)] No such connection need to be cancelled
08-08 09:49:00.329 17671 17671 I Process : Sending signal. PID: 17671 SIG: 9
08-08 09:49:00.329  1788  2603 E bt_stack: [ERROR:bta_gattc_utils.cc(441)] bta_gattc_mark_bg_conn unable to find the bg connection mask for bd_addr=f8:12:82:78:09:12
08-08 09:49:00.329  1788  2603 I bt_stack: [INFO:gatt_api.cc(1042)] GATT_Deregister gatt_if=14
08-08 09:49:00.330  1549  1549 D CompanionDeviceManagerService: F8:12:82:78:09:12 disconnected w/ reason: (1104) Timeout
08-08 09:49:00.330  1549  1549 D CompanionDeviceManagerService: onDeviceDisconnected(address = F8:12:82:78:09:12)
08-08 09:49:00.332 20042 20042 I AmbBrdcstRcvrServClient: (REDACTED) handleRefreshAction(): not handling %s
08-08 09:49:00.332 20042 20148 I BrdcstRcvrMsgr: (REDACTED) sendMessage(): received broadcast id:%d with action:%s
08-08 09:49:00.332  1549  1583 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-08 09:49:00.332  1549  1583 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-08 09:49:00.332  1549  1583 W BroadcastQueue: Permission Denial: receiving Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED flg=0x5000010 (has extras) } to com.google.android.apps.wearables.maestro.companion/.connectivity.ClassicBTReceiver requires android.permission.BLUETOOTH_CONNECT due to sender com.android.bluetooth (uid 1002)
08-08 09:49:00.341 20042 20236 I AssistantForeground: (REDACTED) Get launcher package: %s
adumat commented 1 year ago

Have you find a solution for this issue? i have also this issue but with different versions (rn and ble-manager)

Burzo commented 1 year ago

@adumat Unfortunately not. I also found no workarounds for this.

Burzo commented 9 months ago

Why was this closed? The issues still exists, and I can see it reliably pop up in our logs.

marcosinigaglia commented 9 months ago

Hi @Burzo , we only support latest library version. If you have the error with the latest I'll reopen the issue.