Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Reinitializing ChipController on Android faults in ICDClientStorage #36346

Open
jonsmirl opened this issue Nov 2, 2024 · 2 comments
Open
Labels
android bug Something isn't working needs triage

Comments

@jonsmirl
Copy link
Contributor

jonsmirl commented Nov 2, 2024

Reproduction steps

@yunhanw-google
My Android app supports multiple homes, when I switch homes I need to make another ChipController object because I have to initialize using a different operational key. Now when I make the second controller I am faulting in the ICD code. I have no ICD specific code in my Android app. I don't explicitly delete the first controller instance, I was relying on garbage collection to recover it so there will be two controller instances around until that happens. This is code which had been working for several years. Do I have to do something special now for ICD support?

Note that I am a little bit behind head (Aug 27), if this has been fixed I can update. But I looked in the git logs and didn't see anything that looked like a fix.

2024-11-01 23:33:00.500 30717-30717 AndroidRuntime          com.lowpan.m2                        E  FATAL EXCEPTION: main (Ask Gemini)
                                                                                                    Process: com.lowpan.m2, PID: 30717
                                                                                                    chip.devicecontroller.ChipDeviceControllerException: src/app/icd/client/DefaultICDClientStorage.cpp:159: CHIP Error 0x00000003: Incorrect state
                                                                                                    	at chip.devicecontroller.ChipDeviceController.newDeviceController(Native Method)
                                                                                                    	at chip.devicecontroller.ChipDeviceController.<init>(ChipDeviceController.java:69)
                                                                                                    	at com.lowpan.m2.chip.ChipClient$1$1.emit(ChipClient.kt:196)
                                                                                                    	at com.lowpan.m2.chip.ChipClient$1$1.emit(ChipClient.kt:96)
                                                                                                    	at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:396)
                                                                                                    	at kotlinx.coroutines.flow.StateFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:959)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8705)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
                    chipDeviceController = ChipDeviceController(
                        ControllerParams.newBuilder(operationalKeyConfig()).setUdpListenPort(0)
                            .setControllerVendorId(Lowpan.COMPANY).build()
                    ).also { chipDeviceController ->

Bug prevalence

always

GitHub hash of the SDK that was being used

ea679d2

Platform

android

Platform Version(s)

No response

Anything else?

No response

@yunhanw-google
Copy link
Contributor

@jonsmirl thanks for pointing out this issue, could you have a try on this fix?
#36348

@jonsmirl
Copy link
Contributor Author

jonsmirl commented Nov 3, 2024

I tested in my app and fault is gone. I am not using ICD so I don't know if that was still working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working needs triage
Projects
Status: Todo
Development

No branches or pull requests

3 participants