project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.4k stars 1.98k forks source link

[BUG] Android project error for ble connect #30542

Open freemanspace opened 10 months ago

freemanspace commented 10 months ago

Reproduction steps

Android project

do commission flow

deviceController = ChipClient.getDeviceController(context) deviceController.pairDevice(gatt, connId, deviceId, mDeviceInfo!!.setupPinCode, network)

first time pair will receive error code 50 (wifi setting issue) with GenericChipDeviceListener.onCommissioningComplete(nodeId: Long, errorCode: Int)

than i reset device and do commission flow again

deviceController.pairDevice(gatt, connId, deviceId, mDeviceInfo!!.setupPinCode, network)

i will receive error "Bluetooh connection already in use" with GenericChipDeviceListener.onError(error: Throwable?)

why??

Bug prevalence

every time

GitHub hash of the SDK that was being used

73c327e91a4252daac96728452e8cb713ea83697

Platform

android

Platform Version(s)

No response

Anything else?

No response

freemanspace commented 10 months ago

i try do before pairDevice fun do deviceController.close() than deviceController = deviceController = ChipClient.getDeviceController(context) deviceController.pairDevice(gatt, connId, deviceId, mDeviceInfo!!.setupPinCode, network) will crash log===> 2023-11-20 11:31:58.403 20018-20018 AndroidRuntime com.test E FATAL EXCEPTION: main Process: com.test, PID: 20018 chip.devicecontroller.ChipDeviceControllerException: src/transport/raw/BLE.cpp:118: CHIP Error 0x0000000B: No memory at chip.devicecontroller.ChipDeviceController.pairDevice(Native Method) at chip.devicecontroller.ChipDeviceController.pairDevice(ChipDeviceController.java:160) at chip.devicecontroller.ChipDeviceController.pairDevice(ChipDeviceController.java:129) at com.google.chip.chiptool.SharedMatterViewModel$pairDeviceWithBle$1.invokeSuspend(SharedMatterViewModel.kt:193) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

Trishia commented 8 months ago

I have faced same issue about "No memory" error on second time, "Bluetooth connection already in use" error on third time once commissioning failed at the step "FindOperational" over BLE, even if I released gatt resources such as gatt.disconnect(), gatt.close(), chipDeviceController.close() etc in onError() callback.

Allen-Guof commented 8 months ago

Save issue.

VinhBH1 commented 3 months ago

any update , the same here