Crash - Unable to unbind to service com.onesignal.SyncJobService
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.
Issue
@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.
Details Need
To debug the issue please provide the following;
- Number of instances and devices.
- All device models and Android version effected.
- Steps to reproduce if possible.
- Please provide a full logcat if you are able to reproduce.
What I have gathered. It happen 3 times on production, I'm not able to reproduce, devices:
- Android 10, device SM-A505FN
- Android 10, device SM-G965F
- Android 9, device SM-G950F Seems like some Samsung devices. App has over 100k users active so 3 crashes is not the end of the world. Stacktrace is same as in my first post.
@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.
I've 4.55k occurrences in last 30 days with ANR executing service MY_PACKAGE_HERE/com.onesignal.SyncJobService, InvisibleToUser using OneSignal SDK as 3.15.2. And 1.54k in last 2 weeks using OneSignal SDK as 3.15.7.
With executing service MY_PACKAGE_HERE/com.onesignal.SyncJobService, looking for same versions and time interval, we got 1.76k and 503 occurrences.
How can I solve this ANR?
@pedrofsn You noted on the #1426 issue you were able to reproduce the crash on you test device. Could you attach a full (no filters and verbose) logcat as a .txt/.log to this issue? The problem is that something else could be crashing your app and this is just a next thing that is failing that isn't being caught.
Hi @tajchert, @pedrofurtado, @sokarcreative, @pedrofsn,
I am checking in on this issue, are you still seeing active crashes for your users?
v4.7.4
Fatal Exception: java.lang.RuntimeException: Unable to create service com.onesignal.SyncJobService: java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4643)
Caused by java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4637)