Description:
Crash Unable to unbind to service. It doesn't contain any reference to my package code, and I cannot determine when it crashed in app lifecycle.
Environment
OneSignal SDK: 3.13.2
OneSignal Gradle Plugin: 0.12.7
Android (crash): 9
Gradle 5.6.4
targetSDK: 28
compileSDK: 28
buildTools:28.0.3
Such issue was reported to my crash analytics (it was fatal to the app):
Stacktrace:
java.lang.RuntimeException: Unable to unbind to service com.onesignal.SyncJobService@fa9da55 with Intent { cmp=pl.tajchert.canary/com.onesignal.SyncJobService }: java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleUnbindService(ActivityThread.java:3827)
at android.app.ActivityThread.access$1600(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleUnbindService(ActivityThread.java:3821)
at android.app.ActivityThread.access$1600(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
android.os.DeadSystemException: null
at android.app.ActivityThread.handleUnbindService(ActivityThread.java:3821)
at android.app.ActivityThread.access$1600(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
I noticed other crash with almost same stacktrace:
java.lang.RuntimeException: Unable to create service com.onesignal.SyncJobService: java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3768)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3762)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
android.os.DeadSystemException: null
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3762)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
To provide more informations about this bug, we here use the following scenario:
Android SDK: 3.13.2 (latest)
Cordova SDK: 2.9.1 (latest)
@tajchert we also could not simulate the error locally, although the bug is ocurring in Google Play ANR/Crashes dashboard.
Some printscreens for OneSignal team help us how to troubleshooting this 馃 :


Sorry of large images, but I expanded everything in order to all stacktrace be visible 馃憤
@pedrofurtado Your ANR is unrelated to the original issue. It has been fixed in the 3.14.0 release however. Please use a text copy of the stacktraces in the future (even if it is long) so they are searchable.
@tajchert Thanks for the stacktrace, however since it is a android.os.DeadSystemException the root cause will be difficult to find.
The "Unable to unbind to service" isn't the error it's, but rather something your app tried to do after Android started a runtime restart.
See the following comment from the Android ASOP source.
/**
* The core Android system has died and is going through a runtime restart. All
* running apps will be promptly killed.
*/
https://stackoverflow.com/a/44395215/1244574
Since it is a runtime restart on the device it could be the result of any app.
To debug the issue please provide the following;
What I have gathered. It happen 3 times on production, I'm not able to reproduce, devices:
@tajchert Thanks for the details. Since the number of crashes are low and it doesn't seem like this crash is directly related to OneSignal we are marking this as low priority until we can get more details on the issue or the number of crashes greatly increases.
Same problem here in production (Android 10, Nokia 6.1). My colleague said to me that he has seen this crash report at the exact time he received the same notification on iOS.
Most helpful comment
@pedrofurtado Your ANR is unrelated to the original issue. It has been fixed in the 3.14.0 release however. Please use a text copy of the stacktraces in the future (even if it is long) so they are searchable.