Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IllegalStateException when scheduling repeating work with WorkManager

We have an app where we are scheduling a repeating work using the latest version of Android work manager, 1.00.00. The work runs every 20 minutes. After releasing an update we have noticed the following crash in the Google Developer console.

java.lang.IllegalStateException: 
  at android.os.Parcel.readException (Parcel.java:1691)
  at android.os.Parcel.readException (Parcel.java:1636)
  at android.app.job.IJobScheduler$Stub$Proxy.schedule (IJobScheduler.java:158)
  at android.app.JobSchedulerImpl.schedule (JobSchedulerImpl.java:42)
  at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal (SystemJobScheduler.java:161)
  at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule (SystemJobScheduler.java:128)
  at androidx.work.impl.Schedulers.schedule (Schedulers.java:91)
  at androidx.work.impl.utils.ForceStopRunnable.run (ForceStopRunnable.java:100)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607)
  at java.lang.Thread.run (Thread.java:761)

The error happens only (100%) on devices running Android 7.0 and 7.1. We have no way of knowing what is causing this since there is no mention of our code in the stack trace.

Note that we use custom WorkManager initialization. Also note that the error is probably not visible to the user since we have not received any emails about crashes.

Anyone knows what this is about?

like image 656
a.p. Avatar asked Aug 13 '26 15:08

a.p.


1 Answers

I have reported the above to the WorkManager issue tracker and I have received a reply that makes sense. This seems to be caused by buggy JobScheduler implementations on specific devices. Here is the reply I received.

There are a few devices which ship buggy implementations of JobScheduler. This happens to be a bug in their JobScheduler implementation. These devices are small in number, and this does not happen all the time. WorkManager will reschedule your Worker gracefully when the app restarts. I would not worry about this issue.

Here is the relevant link: https://issuetracker.google.com/issues/122446608

like image 177
a.p. Avatar answered Aug 16 '26 18:08

a.p.