Status Update
Comments
jo...@google.com <jo...@google.com> #3
Artifact used androidx.work:work-runtime:2.3.1
Version used:2.3.1
Theme used:
Devices/Android versions reproduced on:
Pixel devices,One Plus devices / 10.0
Samsung, Realme, Oppo/ 9.0
Motorola / 8.0
- Relevant code to trigger the issue.
WorkManager workManagerInstance = WorkManager.getInstance(context);
Data input = new Data.Builder().putString("xxx", xxx).build();
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED).build();
mGetShowRequest = new OneTimeWorkRequest.Builder(ShowParserWork.class)
.setConstraints(constraints).setInputData(input)
.addTag(TAG_WORKER_NAME)
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 30, TimeUnit.SECONDS).build();
workManagerInstance.enqueueUniqueWork(TAG_WORKER_NAME,
ExistingWorkPolicy.KEEP,mGetShowRequest);
Stacktrace:-
Fatal Exception: java.lang.IllegalStateException: JobScheduler 100 job limit exceeded. We count 101 WorkManager jobs in JobScheduler; we have 20 tracked jobs in our DB; our Configuration limit is 20.
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 199(SystemJobScheduler.java:199)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule + 92(Schedulers.java:92)
at androidx.work.impl.WorkerWrapper.onWorkFinished + 369(WorkerWrapper.java:369)
at androidx.work.impl.WorkerWrapper$2.run + 318(WorkerWrapper.java:318)
at androidx.work.impl.utils.SerialExecutor$Task.run + 91(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
at java.lang.Thread.run + 919(Thread.java:919)
Caused by java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.createException + 2079(Parcel.java:2079)
at android.os.Parcel.readException + 2039(Parcel.java:2039)
at android.os.Parcel.readException + 1987(Parcel.java:1987)
at android.app.job.IJobScheduler$Stub$Proxy.schedule + 308(IJobScheduler.java:308)
at android.app.JobSchedulerImpl.schedule + 43(JobSchedulerImpl.java:43)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 181(SystemJobScheduler.java:181)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule + 92(Schedulers.java:92)
at androidx.work.impl.WorkerWrapper.onWorkFinished + 369(WorkerWrapper.java:369)
at androidx.work.impl.WorkerWrapper$2.run + 318(WorkerWrapper.java:318)
at androidx.work.impl.utils.SerialExecutor$Task.run + 91(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
Caused by android.os.RemoteException: Remote stack trace:
at com.android.server.job.JobSchedulerService.scheduleAsPackage(JobSchedulerService.java:1038)
at com.android.server.job.JobSchedulerService$JobSchedulerStub.schedule(JobSchedulerService.java:2740)
at android.app.job.IJobScheduler$Stub.onTransact(IJobScheduler.java:153)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
This issue has resurfaced only on our production builds, with multiple instances of crashes. Can you let us know a fix for this issue? Thanks
jo...@google.com <jo...@google.com> #4
We fixed a bug recently, where there is a mismatch between WorkManager
s tracking of jobs in JobScheduler
and the actual state of the jobs
. This happens in very rare cases, and I think that's what is going on in your case.
This change (WorkManager
2.3.2 very soon.
If you cannot wait, you can use a snapshot build that should be identical to the eventual release.
Here is the gradle snippet you will need:
repositories {
google()
maven { url 'https://ci.android.com/builds/submitted/6195753/androidx_snapshot/latest/repository/' }
}
dependencies {
implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT"
}
One other thing you might need to do is to get rid of stale jobs. It is as simple as calling JobScheduler.cancelAllJobs()
before WorkManager is initialized. You can do it inside Application.onCreate()
in your Application subclass.
jo...@google.com <jo...@google.com> #5
jo...@google.com <jo...@google.com> #6
Failed to resolve: androidx.work:work-runtime:2.4.0-SNAPSHOT
<a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Affected Modules: <a href="openFile:D:/ Android App/app/build.gradle">app</a>
In my Application class, we have added WorkManager.getInstance(this).cancelAllWork();.Also, should I use the same work manager instance from my application class for all my work requests?
ha...@gmail.com <ha...@gmail.com> #7
Coming from stackoverflow here.
The build you mentioned doesn't seem to exist, and when I use the latest build (
I get some very weird missing library errors.
jo...@google.com <jo...@google.com> #8
My apologies for the delay. Try using this. This is from our dev branch.
repositories {
google()
maven { url 'https://ci.android.com/builds/submitted/6215972/androidx_snapshot/latest/repository/' }
}
dependencies {
implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT"
}
ha...@gmail.com <ha...@gmail.com> #9
ap...@google.com <ap...@google.com> #10
My apologies, it looks like the artifacts were not generated for that build. I have verified that this one works:
repositories {
google()
maven { url '
dependencies { implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT" }
jo...@google.com <jo...@google.com>
ha...@gmail.com <ha...@gmail.com> #11
My apologies, it looks like the artifacts were not generated for that build. I have verified that this one works:
repositories {
google()
maven { url 'https://ci.android.com/builds/submitted/6217200/androidx_snapshot/latest/repository/' }
}
dependencies {
implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT"
}
jo...@google.com <jo...@google.com> #12
ha...@gmail.com <ha...@gmail.com> #13
Logs:
androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 199 (SystemJobScheduler.java:199)
androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127 (SystemJobScheduler.java:127)
androidx.work.impl.Schedulers.schedule + 92 (Schedulers.java:92)
androidx.work.impl.utils.ForceStopRunnable.run + 98 (ForceStopRunnable.java:98)
androidx.work.impl.utils.SerialExecutor$Task.run + 91 (SerialExecutor.java:91)
java.util.concurrent.ThreadPoolExecutor.runWorker + 1133 (ThreadPoolExecutor.java:1133)
java.util.concurrent.ThreadPoolExecutor$Worker.run + 607 (ThreadPoolExecutor.java:607)
java.lang.Thread.run + 761 (Thread.java:761)
Caused by java.lang.IllegalStateException
Apps may not schedule more than 100 distinct jobs
android.os.Parcel.readException + 1691 (Parcel.java:1691)
android.os.Parcel.readException + 1636 (Parcel.java:1636)
android.app.job.IJobScheduler$Stub$Proxy.schedule + 158 (IJobScheduler.java:158)
android.app.JobSchedulerImpl.schedule + 42 (JobSchedulerImpl.java:42)
androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 181 (SystemJobScheduler.java:181)
androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127 (SystemJobScheduler.java:127)
androidx.work.impl.Schedulers.schedule + 92 (Schedulers.java:92)
androidx.work.impl.utils.ForceStopRunnable.run + 98 (ForceStopRunnable.java:98)
androidx.work.impl.utils.SerialExecutor$Task.run + 91 (SerialExecutor.java:91)
java.util.concurrent.ThreadPoolExecutor.runWorker + 1133 (ThreadPoolExecutor.java:1133)
java.util.concurrent.ThreadPoolExecutor$Worker.run + 607 (ThreadPoolExecutor.java:607)
java.lang.Thread.run + 761 (Thread.java:761)
As you can see this log line :-
androidx.work.impl.utils.ForceStopRunnable.run + 98 (ForceStopRunnable.java:98)
This is happening during force stop or application got killed
Will this fix cover this scenario as well??
pr...@google.com <pr...@google.com> #14
Fatal Exception: java.lang.IllegalStateException: JobScheduler 100 job limit exceeded. We count 101 WorkManager jobs in JobScheduler; we have 20 tracked jobs in our DB; our Configuration limit is 20.
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:199)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:92)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:98)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
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)
IMPORTANT INFO
95% of affected devices are OPPO, Xiaomi and Redmi. Only one Huawey and one Samsung afected.
100% of affected devices are Android 7
100% of affected devices had less than 900MB disk free.
Our app allows the user to download content in background using WorkManager. A user can easily launch several hundred of very small downloads (10~100K) at the same time. The downloaded content can easily reach 300~600MB in total.
pa...@gmail.com <pa...@gmail.com> #15
Fatal Exception: java.lang.IllegalStateException: JobScheduler 100 job limit exceeded. We count 3 WorkManager jobs in JobScheduler; we have 7 tracked jobs in our DB; our Configuration limit is 20.
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:199)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:92)
at androidx.work.impl.WorkManagerImpl.rescheduleEligibleWork(WorkManagerImpl.java:631)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:90)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.readException(Parcel.java:2024)
at android.os.Parcel.readException(Parcel.java:1962)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:180)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:181)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:92)
at androidx.work.impl.WorkManagerImpl.rescheduleEligibleWork(WorkManagerImpl.java:631)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:90)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
I'm on WorkManager 2.3.4
Can you please provide a resolution for this?
Description
Jetpack Compose version: 1.4.0-alpha04
Jetpack Compose component used: ModalBottomSheetLayout
Android Studio Build: Electric Eel 2022.1.1 #AI-221.6008.13.2211.9477386
Kotlin version: 1.7.21
Repo:https://github.com/hakonschia/bottomsheetcrash
The updated ModalBottomSheetLayout in 1.4.0-alpha04 seems to have some issues. I have observed two cases where it crashes with
Key HalfExpanded is missing in the map
. The linked repo contains both scenarios.First scenario:
I'll add that the bottom sheet "floats" above the bottom of the screen, which seems like a new bug introduced in alpha04. In the example repo this only happens when the sheet is opened in landscape. If I open it in portrait and then rotate, it doesn't happen. It also doesn't crash in this case, so it seems this might be related. This is visible in the video attached.
Second scenario:
The updated ModalBottomSheetLayout is supposed to support empty sheet content, but when going from empty content to some content it crashes.
Steps to reproduce:
I'll add here that I have had to do this hack with empty content to avoid the bottom sheet sometimes being visible when it shouldn't, for example when resizing the window in Picture-in-Picture mode (which might be related to https://issuetracker.google.com/issues/260517771 ). I've added a button to enter PiP where this issue can be seen by removing the logic to not render the content when not visible.
Adding
Spacer(Modifier.height(1.dp))
fixes this crash, which is what I had to do previously anyways since empty content wasn't supported, but I'd like to remove this hack.Stack trace (if applicable):