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

Fatal Exception: java.lang.RuntimeException: android.os.DeadObjectException #26

Closed
eveliotc opened this Issue Jun 27, 2016 · 14 comments

Comments

Projects
None yet
8 participants
@eveliotc

eveliotc commented Jun 27, 2016

Received this through crash reporting:

Fatal Exception: java.lang.RuntimeException: android.os.DeadObjectException
       at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:39)
       at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162)
       at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69)
       at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41)
       at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:158)
       at android.app.ActivityThread.main(ActivityThread.java:7224)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by android.os.DeadObjectException
       at android.os.BinderProxy.transactNative(Binder.java)
       at android.os.BinderProxy.transact(Binder.java:503)
       at com.google.android.gms.gcm.INetworkTaskCallback$Stub$Proxy.taskFinished(INetworkTaskCallback.java:85)
       at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:37)
       at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162)
       at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69)
       at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41)
       at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:158)
       at android.app.ActivityThread.main(ActivityThread.java:7224)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

My current theory is that this is caused because jobFinished is being called after onStopJob so will add measures to prevent this will report if this continues to happen.

@eveliotc

This comment has been minimized.

eveliotc commented Jun 30, 2016

This continues to happen, ensuring jobFinished is not called after onStopJob didn't make a difference, happening on the following devices at the moment

  • SM-G930T (Android 6.0.1)
  • SM-G530T1 (Android 5.1.1)
@YohayBar

This comment has been minimized.

YohayBar commented Aug 1, 2016

same here:
Fatal Exception: java.lang.RuntimeException: android.os.DeadObjectException at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:39) at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162) at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69) at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41) at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5584) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(NativeStart.java) Caused by android.os.DeadObjectException at android.os.BinderProxy.transact(Binder.java) at com.google.android.gms.gcm.INetworkTaskCallback$Stub$Proxy.taskFinished(INetworkTaskCallback.java:85) at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:37) at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162) at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69) at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41) at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5584) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(NativeStart.java)

@maksim88

This comment has been minimized.

maksim88 commented Sep 12, 2016

Got the same one:

Fatal Exception: java.lang.RuntimeException: android.os.DeadObjectException
       at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:39)
       at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162)
       at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69)
       at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41)
       at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:176)
       at android.app.ActivityThread.main(ActivityThread.java:5419)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by android.os.DeadObjectException
       at android.os.BinderProxy.transact(Binder.java)
       at com.google.android.gms.gcm.INetworkTaskCallback$Stub$Proxy.taskFinished(INetworkTaskCallback.java:85)
       at com.firebase.jobdispatcher.GooglePlayJobCallback.jobFinished(GooglePlayJobCallback.java:37)
       at com.firebase.jobdispatcher.GooglePlayReceiver.onJobFinished(GooglePlayReceiver.java:162)
       at com.firebase.jobdispatcher.ExternalReceiver.onJobFinishedMessage(ExternalReceiver.java:69)
       at com.firebase.jobdispatcher.ExternalReceiver.access$200(ExternalReceiver.java:41)
       at com.firebase.jobdispatcher.ExternalReceiver$ResponseHandler.handleMessage(ExternalReceiver.java:115)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:176)
       at android.app.ActivityThread.main(ActivityThread.java:5419)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
       at dalvik.system.NativeStart.main(NativeStart.java)

Affected devices:
Samsung GT-I9300 (Android 4.3)
Asus K00F (Android 4.2.2)

@yahor-makouski-epam

This comment has been minimized.

yahor-makouski-epam commented Oct 19, 2016

+1
Experiencing the same problem

@eveliotc

This comment has been minimized.

eveliotc commented Oct 24, 2016

This is averaging ~100 daily crashes, during Google Play Services outage last Friday we saw a spike of 900+ crashes.

@ciarand

This comment has been minimized.

Contributor

ciarand commented Oct 24, 2016

Are you all running against the version that includes 43ea532?

@yahor-makouski-epam

This comment has been minimized.

yahor-makouski-epam commented Oct 25, 2016

Yes, the crash still persists in the latest version with the fix 43ea532.

Here are the steps to reproduce the crash:

  1. start long running job
  2. kill com.google.android.gms/.gcm.GcmService. I have a rooted device so I can do that via adb shell kill PID
  3. when long running job is finished we invoke jobFinished() method

DeadObjectException occurs in GooglePlayJobCallback#jobFinished()
I think we should not throw RuntimeException when any RemoteException occurs.

And also when I kill GcmService the service is restarted automatically but no jobs are rescheduled. But this is something to be fixed on GCM library side.

@outlying

This comment has been minimized.

outlying commented Oct 25, 2016

Same stacktrace for me, my job scheduling code can be found here and it will trigger actions in this service (tl;dr it force widgets to update more frequently)

@ciarand

This comment has been minimized.

Contributor

ciarand commented Oct 26, 2016

We're reviewing a fix for this and hope to have it out this week. We'll tag a new version when that happens.

@kusan-thana

This comment has been minimized.

kusan-thana commented Dec 5, 2016

Is there a fix yet?

Because otherwise I'll have to go look at official API....

Thank you in advance,

ciarand added a commit that referenced this issue Dec 16, 2016

Handle errors when sending task results back
Most of the receiver code that communicates back with Google Play
services uses the sendResultsSafely method to correctly guard against
the possibility of a RemoteException occurring. Unfortunately the
routine that returns the result at the end of execution did not. This
can cause a DeadObjectException if Google Play services dies before the
task result is sent.

Update the onJobFinished callback to use sendResultsSafely instead of
potentially crashing the client app.

Fixes #26.

@ciarand ciarand closed this in #67 Dec 16, 2016

@yahor-makouski-epam

This comment has been minimized.

yahor-makouski-epam commented Dec 16, 2016

@ciarand could you please release a new version with the fix?
It's very important for us.

@ciarand

This comment has been minimized.

Contributor

ciarand commented Dec 16, 2016

Yes, I'm just chasing a couple of other PRs that would be good to get into this release. Regardless of what else happens we'll have a new version within 8 hours or so.

@ciarand

This comment has been minimized.

Contributor

ciarand commented Dec 17, 2016

Cut v0.5.1, which should be available on JCenter now.

@Ansh1234

This comment has been minimized.

Ansh1234 commented Jan 16, 2017

Why is this issue closed when it is still not fixed? Also, there is no v0.5.1 pushed out yet. Getting close to 100 crashes because of this. Please help fix this soon.

If I include the following dependency compile 'com.firebase:firebase-jobdispatcher:0.5.2', then it works fine. But if I include the following dependency compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2', then it shows that the dependency does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment