liblinphone
liblinphone copied to clipboard
[Bug]: Crash when calling core.stop() on Android
Context
Liblinphone is being used as a gradle dependency to add SIP audio/video calling to an automation app. The goal is to only be utilizing Liblinphone resources when needed and to tear down when not in use.
General information
- Device: Asus Zenfone 9
- OS: Android 12.1
- Version of the App: N/A
- Version of the SDK: 5.2.109
Expected behaviour
After making a video or audio call, Liblinphone resources are torn down using core.stop()
and the library is expected to be re-initialized if SIP resources are needed. The crash during core.stop()
is preventing this and our only option currently is to leave the service running.
To Reproduce
- Make a call using liblinphone (Doesn't need to connect, phone just needs to register to SIP server)
- End call
- Call
core.stop()
to cleanup resources - Observe repeatable crash on Android
Additional context
Below is a stacktrace of the crash. The issue of CoreManager
not being instantiated is outside of our control as far as I can tell because a valid instance exists just prior to calling core.stop()
. It seems like there's still a race condition between CoreManager.onLinphoneCoreStop()
and CoreManager.destroy()
.
2023-10-05 08:03:09.517 9620-9620 AndroidRuntime net.test.myapp E FATAL EXCEPTION: main
Process: net.test.myapp, PID: 9620
java.lang.RuntimeException: Unable to stop service org.linphone.core.tools.service.CoreService@562ccee: java.lang.RuntimeException: CoreManager not instantiated yet
at android.app.ActivityThread.handleStopService(ActivityThread.java:4846)
at android.app.ActivityThread.access$2100(ActivityThread.java:266)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2203)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:241)
at android.os.Looper.loop(Looper.java:358)
at android.app.ActivityThread.main(ActivityThread.java:8068)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
Caused by: java.lang.RuntimeException: CoreManager not instantiated yet
at org.linphone.core.tools.service.CoreManager.instance(CoreManager.java:78)
at org.linphone.core.tools.service.CoreService.onDestroy(CoreService.java:157)
at android.app.ActivityThread.handleStopService(ActivityThread.java:4826)
at android.app.ActivityThread.access$2100(ActivityThread.java:266)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2203)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:241)
at android.os.Looper.loop(Looper.java:358)
at android.app.ActivityThread.main(ActivityThread.java:8068)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
SDK logs URL
No response