Fixed
Status Update
Comments
ra...@google.com <ra...@google.com> #2
ra...@google.com <ra...@google.com> #3
I think that ResultReceiver will "forever" stay in the old package since otherwise it would be a breaking AIDL-related change.
d....@googlemail.com <d....@googlemail.com> #4
Yep, it has to stay in the old package.
> Jetifier is changing the import in the library to "androidx.core.os.ResultReceiver"
Config issue.
> Jetifier is changing the import in the library to "androidx.core.os.ResultReceiver"
Config issue.
ra...@google.com <ra...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 2bf39653103b1ce6b3b6fc64b44faaa9fcad1c19
Author: Filip Pavlis <pavlis@google.com>
Date: Tue Feb 12 19:41:53 2019
Revert changes in default.config and remove task.
It turned out that we have released (as part of beta03) mappings that
were not supposed to be used externally. This is because we were actively
maintaining "dejetifyArchive" task without realizing that next jetifier
update will contain such changes. As we are done with 28.0.0 I think it
is a good time to sunset the "dejetifyArchive" target. I also reverted
all the config changes that are not supposed to go outside. Please note
that there is still "partiallyDejetifyArchive" for migration purpouses
and is still part of continuous build.
Also added ignore rule for ResultReceiver.
Bug: b/123651524
Bug: b/124291947
Test: N/A
Change-Id: I59983d25ae7e0939f2e9e54005460ad0f73beb3c
M buildSrc/jetify.gradle
M buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
M buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
M jetifier/jetifier/core/src/main/resources/default.config
M jetifier/jetifier/core/src/main/resources/default.generated.config
https://android-review.googlesource.com/902433
https://goto.google.com/android-sha1/2bf39653103b1ce6b3b6fc64b44faaa9fcad1c19
Branch: androidx-master-dev
commit 2bf39653103b1ce6b3b6fc64b44faaa9fcad1c19
Author: Filip Pavlis <pavlis@google.com>
Date: Tue Feb 12 19:41:53 2019
Revert changes in default.config and remove task.
It turned out that we have released (as part of beta03) mappings that
were not supposed to be used externally. This is because we were actively
maintaining "dejetifyArchive" task without realizing that next jetifier
update will contain such changes. As we are done with 28.0.0 I think it
is a good time to sunset the "dejetifyArchive" target. I also reverted
all the config changes that are not supposed to go outside. Please note
that there is still "partiallyDejetifyArchive" for migration purpouses
and is still part of continuous build.
Also added ignore rule for ResultReceiver.
Bug:
Bug:
Test: N/A
Change-Id: I59983d25ae7e0939f2e9e54005460ad0f73beb3c
M buildSrc/jetify.gradle
M buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
M buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
M jetifier/jetifier/core/src/main/resources/default.config
M jetifier/jetifier/core/src/main/resources/default.generated.config
d....@googlemail.com <d....@googlemail.com> #6
FYI, in AGP 3.4.0-rc03 and 3.5.0-alpha09, the AGP has been updated to use Jetifier 1.0.0-beta04, which should have the fix for the above issue: https://android.googlesource.com/platform/tools/base/+/f7fdfbb94aebb43b7e9515c683fd71b8c905ee79 .
ra...@google.com <ra...@google.com> #7
Closing as fixed.
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 2d2b53f0f39033e72b686d5b56ad8be2e5eec900
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Jun 04 12:42:38 2019
Notify constraint changes on the main thread only.
Fixes: b/134361006
Test: Ran integration tests. Updated unit tests.
Change-Id: I3e84c5f3229c30e810638ba97fb4ac5414288faa
M work/workmanager-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.java
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkManagerImplLargeExecutorTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/background/greedy/GreedySchedulerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/background/systemalarm/SystemAlarmDispatcherTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/BatteryChargingTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/BatteryNotLowTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/ConstraintTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/NetworkStateTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/StorageNotLowTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/workers/ConstraintTrackingWorkerTest.java
M work/workmanager/src/main/java/androidx/work/impl/WorkManagerImpl.java
M work/workmanager/src/main/java/androidx/work/impl/background/greedy/GreedyScheduler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/ConstraintsCommandHandler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/DelayMetCommandHandler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/SystemAlarmDispatcher.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/ConstraintListener.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/WorkConstraintsTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/BatteryChargingController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/BatteryNotLowController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkConnectedController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkMeteredController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkNotRoamingController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkUnmeteredController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/StorageNotLowController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BatteryChargingTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BroadcastReceiverConstraintTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/ConstraintTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/StorageNotLowTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/Trackers.java
M work/workmanager/src/main/java/androidx/work/impl/workers/ConstraintTrackingWorker.java
https://android-review.googlesource.com/975608
https://goto.google.com/android-sha1/2d2b53f0f39033e72b686d5b56ad8be2e5eec900
Branch: androidx-master-dev
commit 2d2b53f0f39033e72b686d5b56ad8be2e5eec900
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Jun 04 12:42:38 2019
Notify constraint changes on the main thread only.
Fixes:
Test: Ran integration tests. Updated unit tests.
Change-Id: I3e84c5f3229c30e810638ba97fb4ac5414288faa
M work/workmanager-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.java
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkManagerImplLargeExecutorTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/background/greedy/GreedySchedulerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/background/systemalarm/SystemAlarmDispatcherTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/BatteryChargingTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/BatteryNotLowTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/ConstraintTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/NetworkStateTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/StorageNotLowTrackerTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/workers/ConstraintTrackingWorkerTest.java
M work/workmanager/src/main/java/androidx/work/impl/WorkManagerImpl.java
M work/workmanager/src/main/java/androidx/work/impl/background/greedy/GreedyScheduler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/ConstraintsCommandHandler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/DelayMetCommandHandler.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/SystemAlarmDispatcher.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/ConstraintListener.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/WorkConstraintsTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/BatteryChargingController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/BatteryNotLowController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkConnectedController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkMeteredController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkNotRoamingController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkUnmeteredController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/StorageNotLowController.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BatteryChargingTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/BroadcastReceiverConstraintTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/ConstraintTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/StorageNotLowTracker.java
M work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/Trackers.java
M work/workmanager/src/main/java/androidx/work/impl/workers/ConstraintTrackingWorker.java
Description
Version used: 1.0.1
Devices/Android versions reproduced on: different Samsung Galaxy devices running Android 8 and 9
I have received deadlock reports like this:
"main" prio=5 tid=1 Blocked
| group="main" sCount=1 dsCount=0 flags=1 obj=0x76790a58 self=0x7d81014c00
| sysTid=27874 nice=0 cgrp=default sched=0/0 handle=0x7e07c1a560
| state=S schedstat=( 1835900780 7285545518 5958 ) utm=82 stm=100 core=1 HZ=100
| stack=0x7febcdd000-0x7febcdf000 stackSize=8MB
| held mutexes=
at androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener (ConstraintTracker.java:77)
- waiting to lock <0x08a4f10d> (a java.lang.Object) held by thread 13 // ConstraintTracker.mLock
at androidx.work.impl.constraints.controllers.ConstraintController.replace (ConstraintController.java:98)
at androidx.work.impl.constraints.WorkConstraintsTracker.replace (WorkConstraintsTracker.java:99)
- locked <0x0cbac8c2> (a java.lang.Object) // WorkConstrainsTracker.mLock
at androidx.work.impl.background.greedy.GreedyScheduler.removeConstraintTrackingFor (GreedyScheduler.java:153)
- locked <0x0cbec6d3> (a java.lang.Object) // GreedyScheduler.mLock
at androidx.work.impl.background.greedy.GreedyScheduler.onExecuted (GreedyScheduler.java:141)
at androidx.work.impl.Processor.onExecuted (Processor.java:230)
- locked <0x08012210> (a java.lang.Object)
at androidx.work.impl.Processor$FutureListener.run (Processor.java:263)
at android.os.Handler.handleCallback (Handler.java:873)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7032)
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)
"ConnectivityThread" tid=13 Blocked
"ConnectivityThread" prio=5 tid=13 Blocked
| group="main" sCount=1 dsCount=0 flags=1 obj=0x12fc0770 self=0x7d7ab86800
| sysTid=27897 nice=0 cgrp=default sched=0/0 handle=0x7d684114f0
| state=S schedstat=( 247567475 11539483672 1368 ) utm=16 stm=7 core=2 HZ=100
| stack=0x7d6830e000-0x7d68310000 stackSize=1041KB
| held mutexes=
at androidx.work.impl.a.d.c (SourceFile:157) // synchronized (mLock)
- waiting to lock <0x0cbac8c2> (a java.lang.Object) held by thread 1 // trying to lock WorkConstraintsTracker.mLock
at androidx.work.impl.a.a.c.b (SourceFile:133) ConstraintController: mCallback.onConstraintNotMet(mMatchingWorkSpecIds);
at androidx.work.impl.a.a.c.a (SourceFile:142) ConstraintController: updateCallback();
at androidx.work.impl.a.b.d.a (SourceFile:103) listener.onConstraintChanged(mCurrentState);
- locked <0x08a4f10d> (a java.lang.Object) (ConstraintTracker.mLock)
at androidx.work.impl.a.b.e$b.onCapabilitiesChanged (SourceFile:149) (NetworkStateTracker)
at android.net.ConnectivityManager$CallbackHandler.handleMessage (ConnectivityManager.java:3331)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.os.HandlerThread.run (HandlerThread.java:65)
I have written after the lines what is happening there.
The GreedyScheduler has finished executing and onExecuted is called. This tries to remove the workSpecId from the mConstrainedWorkSpecs list. After removing it it calls mWorkConstraintsTracker.replace to send the new list to the WorkContraintsTracker. This causes a lock of WorkConstraintsTracker.mLock and a call to ConstraintController.replace. This calls ConstraintController.removeListener which tries to lock ConstraintController.mLock but fails/deadlocks. So as you can see it has first locked WorkConstraintsTracker.mLock and then it tries to lock ConstraintController.mLock.
As you can see now the other thread does the opposite, which leads to the deadlock: The WorkManager receives a "onCapabilitiesChanges" message and locks ConstraintTracker.mLock. Then it tries to call onConstraintNotMet but it cannot lock WorkConstraintsTracker.mLock, because it is already locked by the upper thread.
So there is a deadlock because both functions are running at the same time and are locking the locks in opposite order. Can you please fix it? Or did I make a mistake somewhere?
(BTW I am only using WorkManager.getInstance, I am not calling "initialize").
Thank you very much!