Status Update
Comments
da...@google.com <da...@google.com> #2
I'm not sure how to edit the description. But forgot to add that this will work when the app is in the foreground. It just doesn't work when you lock your device. I test this by moving the app to the background and then locking my device and checking the logs in Android Studio.
da...@google.com <da...@google.com> #3
It would be great if you could prioritize a fix for this issue. Additionally, if there are any alternative ways we can address this from our side, please let us know. Thank you!
br...@snapchat.com <br...@snapchat.com> #4
We also experienced issues with the new version 2.10.0. In our app a Job that is launched at start of the app is triggered and then immediatly cancelled because constraints are not meet anymore. I tried everything from putting it as a foreground job removing all constraints on the job but the behavior stay the same. I will rollback to 2.9.1 until it's fixed. You will find attached some logs of the WM in our app, take a look at job fec664f7-e40c-4df1-baca-3cbc7e1b1ff9.
ar...@swiggy.in <ar...@swiggy.in> #5
This is happening for us as well when we are targeting 34. This is happening 100% background (not an user perceived ANR) but the count is too high. We are using workmanager 2.8.1 version. We have also checked if there is some third party dependencies running worker based on JobScheduler (not using workmanager). No dependencies is running JobScheduler directly. But this ANR is still happening in multiple mid range devices.
main (native):tid=1 systid=26276
#00 pc 0x99000 libc.so (syscall + 32) (BuildId: d1a98b526f2f94260a53c3055979a4f6)
#01 pc 0x232670 libart.so (art::ConditionVariable::WaitHoldingLocks + 140) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
#02 pc 0x45a5e4 libart.so (artJniMethodEnd + 336) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
#03 pc 0x5be67c libart.so (art_jni_method_end + 12) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:685)
at android.app.job.IJobCallback$Stub$Proxy.acknowledgeStartMessage(IJobCallback.java:434)
at android.app.job.JobServiceEngine$JobHandler.ackStartMessage(JobServiceEngine.java:384)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:196)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8839)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
er...@newsbreak.com <er...@newsbreak.com> #6
We also encountered this issue after upgrading the target SDK to 34, with 99% of occurrences happening on OnePlus devices. Is there anyone who can help reach out to the OnePlus development team?
Additionally, aside from the issue mentioned in #5, I've noticed some ANR stacks that are related to Firebase. It’s possible that the #5 issue could also be related to Firebase.
main (runnable):tid=1 systid=31731
at androidx.camera.camera2.internal.Camera2CameraControlImpl$$InternalSyntheticLambda$9$8980faf06f5f4f7e61ac44ef69905a4e414b39b03b58a1268b7134d61a1ef654$0.<init>(Camera2CameraControlImpl.java)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService.onStartJob(JobInfoSchedulerService.java:49)
at android.app.job.JobService$1.onStartJob(JobService.java:106)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:195)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
main (runnable):tid=1 systid=22285
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.upload(Uploader.java:95)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService.onStartJob(JobInfoSchedulerService.java:49)
at android.app.job.JobService$1.onStartJob(JobService.java:106)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:195)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
vi...@games24x7.com <vi...@games24x7.com> #7
One interesting thing I have observed is that the ANRs are coming when the app is in killed state and the difference between last Crashlytics breadcrumbs and ANR detection is very random like from 20 mins to even 10 hours i.e. user's Application class is created at X time but the ANR reporting time is like 2 hours after that or 4 hours after that.
at android.os.MessageQueue.nativePollOnce(Native method)
at android.os.MessageQueue.next(MessageQueue.java:339)
at android.os.Looper.loopOnce(Looper.java:186)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8396)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
ka...@smule.com <ka...@smule.com> #8
We are experiencing the same issue. It looks mostly like this:
main (native):tid=1 systid=17000
#00 pc 0x99ccc libc.so (syscall + 28) (BuildId: a87e89fc2c0a5753053f536add4d7ae1)
#01 pc 0x232670 libart.so (art::ConditionVariable::WaitHoldingLocks + 140) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
#02 pc 0x45a5e4 libart.so (artJniMethodEnd + 336) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
#03 pc 0x5be67c libart.so (art_jni_method_end + 12) (BuildId: 2452917c4ff69cbb6e75e5512260946b)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:685)
at android.app.job.IJobCallback$Stub$Proxy.acknowledgeStartMessage(IJobCallback.java:434)
at android.app.job.JobServiceEngine$JobHandler.ackStartMessage(JobServiceEngine.java:384)
at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:196)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
We are also using WorkManager, not JobScheduler directly.
Looking at our Crashlytics logs, the issue seems strongly correlated with lost network connectivity (we log network updates from ConnectivityManager on a background thread). A typical ANR report includes a very recent log for lost network connectivity.
Another equally (if not even more) strong correlation is the BillingClient losing connectivity at about the same time as the ANR happening. A typical ANR report includes a very recent log for the BillingClient being disconnected, with multiple reconnection attempts that succeed, each followed by a disconnect in the next moment.
br...@snapchat.com <br...@snapchat.com> #9
We are also observing a significant increase in BG ANRs for OnePlus devices as mentioned in
I shared more details on impacted devices / timing of crash spike on our existing email thread.
mk...@adobe.com <mk...@adobe.com> #10
ra...@nykaa.com <ra...@nykaa.com> #11 Restricted
am...@nykaa.com <am...@nykaa.com> #12
Issues are on one plus and oppo devices and all are on background thread.
yu...@google.com <yu...@google.com> #13
Can anyone repro the crash on Oppo/ OnePlus? We have heard accounts that this is happening on certain manufacturers more often. If we can identify a specific issue with a manufacturer, please create share a system trace and file a bug report. We currently do not have enough information to share with the manufacturers.
With respect to the ANR "No response to onStopJob" please note the following:
- This is not a WorkManager bug, it is a behavior change in JobScheduler intended to surface potential scenarios where the app is doing work on the main thread that is blocking the system calling onStopJob callback. You can read more in
https://developer.android.com/about/versions/14/behavior-changes-14#jobscheduler-reinforces-behavior however I realize that this description is not helpful if you're not doing blocking work in onStopJob which you should not be when using WorkManager, the library defaults onStopJob callback to be async. If the ANR is happening despite onStopJob being async, this means that there is other work that is blocking the main thread when the callback occurs. You will need to dive into the trace to understand what may be blocking the main thread. - There is currently no evidence that there is a potential Android OS bug, we haven't yet seen a consistent reason why developers are seeing the ANR. Rather, this ANR is adding additional visibility to issues already happening with jobscheduler, which prior to A14, would already drop the job silently if it could not complete onStartJob/onStopJob within the expected time limit of several seconds. The expected user impact of the A14 update is that this will increase cold starts if the ANR occurs while the app in the background. Data currently shows that this ANR rarely happens while the app is in the foreground.
Finally, how do you debug ANRs of this nature? Please check out our
Again, if you have a specific issue you would like to discuss further, please repro the issue and attach the bug report and system trace.
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit b1d2cf10dcef621a1b775cbfb62e85cb60a2b807
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jul 17 19:42:39 2024
Reduce synchronized blocks in SystemJobService
All 3 methods that interact with 'mJobParameters', onStartJob(), onStopJob() and onExecuted() are invoked in the main thread, so there is no need to synchronize interactions with the map. Similarly, StartStopTokens interactions are also done in the main thread, so we can use a version that does not use synchronized blocks.
This changes are done in an attempt to reduce main thread time during onStartJob() and onStopJob() since with Android 14, they can cause an ANR if WorkManager takes too long to complete the method.
Bug: 353295716
Test: Existing
Change-Id: I1319ded3b099ae614eafdfbeb5314f9aa31e724b
M work/work-gcm/src/main/java/androidx/work/impl/background/gcm/WorkManagerGcmDispatcher.java
M work/work-runtime/src/androidTest/java/androidx/work/SchedulersTest.kt
M work/work-runtime/src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java
M work/work-runtime/src/main/java/androidx/work/impl/StartStopToken.kt
M work/work-runtime/src/main/java/androidx/work/impl/background/greedy/GreedyScheduler.java
M work/work-runtime/src/main/java/androidx/work/impl/background/systemalarm/SystemAlarmDispatcher.java
M work/work-runtime/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
M work/work-testing/src/main/java/androidx/work/testing/TestScheduler.kt
ar...@swiggy.in <ar...@swiggy.in> #15
Hi,
Looks like Firebase Crashlytics dependency - com.google.android.datatransport/transport-runtime
is using JobScheduler internally which is causing these ANRs. Crashlytics team acknowledged this and is working on fix in upcoming versions (19.2.0).
am...@nykaa.com <am...@nykaa.com> #16
mw...@gmail.com <mw...@gmail.com> #17
"Previous to Androqid 14, these app closures still occurred, but where not reported as ANRs, so while it may be worrying to see this ANR spike in Android 14, your user's behavior is not degraded."
Does the previous work manager versions has this issue and is this resolved now with the change as mentioned in #14?
Any updates on this by OEM partners or libraries that uses Job service?
Description
Background
We are in the process of upgrading to TargetSDK 34 which has the following behavior change for work scheduling :
We are observing a significant increase in BG ANRs with the error message "No response to onStopJob"; however, we are already effectively using WorkManager in all applicable scenarios. I can share a doc with more internal details over email highlighting our usages of Jobscheduling which could be potentially problematic.
Issue
Below are some of the top stacktraces as reported through Play Store. We also have separate reports through AppExitInfo which only report "No response to onStopJob" without any stacktraces.
and
Additional Info
We had tried rolling out the Target SDK 34 version bump last month, but saw a significant spike in BG ANRs for VIVO devices. Working with VIVO, they were able to identify the issue with a bad interaction with app freezing which has now been fixed.
From the remaining AppExitInfo reports, we see the following which may indicate an issue with app freezer interactions for other OEMs as well.
I've attached a screenshot of the top affected devices. Potentially, we need to reach out to other OEMs to address this problem (e.g. MOTOROLA, GOOGLE, SONY).
As a consequence of this issue, we are seeing that affected devices are having an increase in cold starts instead of warm / hot starts.