-
Notifications
You must be signed in to change notification settings - Fork 238
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
androidx.work.impl.constraints.WorkConstraintsTracker in onConstraintMet - java.util.ConcurrentModificationException #56
Comments
* There is a chance of a race condition in WorkConstraintsTracker. Constraint changes typically take place on the main thread, and WorkManager enqueue() and cancel() happens on the WorkManager's task executor thread. So there is a chance for a ConcurrentModificationException for the list of workSpecs being tracked. Test: Existing tests pass. Change-Id: I066ce8e0aa626a2778e77d7eaf69a90fb4e1c9c2 Related GitHub issue: android/codelab-android-workmanager#56
Is there any workaround while the fix is not in production? |
@konstantintuev AFAIK the fix is already out in alpha-06. |
Thanks for reporting this. If you think that this is a problem of the WorkManager library, please open a bug on the WorkManager public issue tracker: https://issuetracker.google.com/issues/new?component=409906&template=1094197 Please reopen if you still think this is an issue with the codelab. |
This has been solved with WorkManager version 1.0.0-alpha11, as described here: https://developer.android.com/jetpack/docs/release-notes#nov_8_2018 |
@pfmaggi This ConcurrentModificationException is not solved. We use Workmanager 1.0.0-beta2 in our app, but ConcurrentModificationException is still happening in WakeLocks.checkWakeLocks. I have decompiled our app and checked the code of WakeLocks to make sure that we are really using the right version of jar. Yes, we are using the right jar and there are
in both newWakeLock and checkWakeLocks methods. But a lot of crash report |
@pfmaggi I just searched issuetracker. Happy to know that a new fix will be in Beta03 and happier to know it did caused by GC just as I guessed. |
Looking on the public IssueTracker, it seems that a similar issue has been fixed in beta-3. The latest WorkManager version available at this moment is 1.0.0-rc02. If you think that this problem is still present in the latest version of the WorkManager library, please open a bug on the WorkManager public issue tracker: https://issuetracker.google.com/issues/new?component=409906&template=1094197 |
Stack Trace
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at androidx.work.impl.constraints.WorkConstraintsTracker.onConstraintMet(WorkConstraintsTracker.java:120)
at androidx.work.impl.constraints.controllers.ConstraintController.updateCallback(ConstraintController.java:123)
at androidx.work.impl.constraints.controllers.ConstraintController.onConstraintChanged(ConstraintController.java:130)
at androidx.work.impl.constraints.trackers.ConstraintTracker.setState(ConstraintTracker.java:89)
at androidx.work.impl.constraints.trackers.NetworkStateTracker$NetworkStateCallback.onCapabilitiesChanged(NetworkStateTracker.java:136)
at android.net.ConnectivityManager$CallbackHandler.handleMessage(ConnectivityManager.java:2711)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
The text was updated successfully, but these errors were encountered: