OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

Crash - Unable to unbind to service com.onesignal.SyncJobService

Open tajchert opened this issue 5 years ago • 12 comments

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)

tajchert avatar May 13 '20 12:05 tajchert

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)

tajchert avatar May 13 '20 12:05 tajchert

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 🤝 :

screencapture-play-google-apps-publish-2020-05-18-09_24_44 screencapture-play-google-apps-publish-2020-05-18-09_26_08

pedrofurtado avatar May 18 '20 13:05 pedrofurtado

Sorry of large images, but I expanded everything in order to all stacktrace be visible 👍

pedrofurtado avatar May 18 '20 13:05 pedrofurtado

@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.

jkasten2 avatar May 25 '20 22:05 jkasten2

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;

  1. Number of instances and devices.
  2. All device models and Android version effected.
  3. Steps to reproduce if possible.
    • Please provide a full logcat if you are able to reproduce.

jkasten2 avatar May 25 '20 22:05 jkasten2

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 avatar May 25 '20 23:05 tajchert

@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.

jkasten2 avatar Jun 11 '20 04:06 jkasten2

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.

sokarcreative avatar Jun 26 '20 07:06 sokarcreative

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 avatar Jun 23 '21 13:06 pedrofsn

@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.

jkasten2 avatar Aug 31 '21 18:08 jkasten2

Hi @tajchert, @pedrofurtado, @sokarcreative, @pedrofsn,

I am checking in on this issue, are you still seeing active crashes for your users?

nan-li avatar Feb 23 '22 19:02 nan-li

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)

KristapsKrumins avatar Aug 29 '22 10:08 KristapsKrumins