Bug P3
Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
Hi
Are there two workers (both setForeground) that execute continuously (one worker is started after the other finished)?
Are there two workers (both setForeground) that execute continuously (one worker is started after the other finished)?
sx...@gmail.com <sx...@gmail.com> #3
Hi, we do have two types of workers calling setForeground.
One is a scheduler which has only one instance at any time. The other type is worker (scheduled by the scheduler) which may have more than one instances running in parallel.
Both types of workers use the same notificationId for setForeground call.
ch...@gmail.com <ch...@gmail.com> #4
We have the same crash and we are trying to figure it out.
We find that a SystemForegroundService will be started when setForeground in Worker.
https://androidx.tech/artifacts/work/work-runtime/2.7.1-source/androidx/work/impl/foreground/SystemForegroundService.java.html
Because we see the log "Re-initializing SystemForegroundService after a request to shut-down." when crash.
We guess that maybe the crash happens when a new setForeground comes after the service is ready to stop.
We find that a SystemForegroundService will be started when setForeground in Worker.
Because we see the log "Re-initializing SystemForegroundService after a request to shut-down." when crash.
We guess that maybe the crash happens when a new setForeground comes after the service is ready to stop.
sx...@gmail.com <sx...@gmail.com> #5
Well yeah that's a good callout, I just double checked and we also see
10-18 00:01:46.859 19634 19634 I WM-SystemFgService: Re-initializing SystemForegroundService after a request to shut-down.
right before the crash. Looks like W-M is not handling some corner cases well.
ro...@gmail.com <ro...@gmail.com> #6
Found any solution for this issue?
Same crash is happening on Samsung Galaxy devices with android 12. I have tried many steps, but unable to reproduce the issue. But getting lots this crashes on Crashlytics.
Same crash is happening on Samsung Galaxy devices with android 12. I have tried many steps, but unable to reproduce the issue. But getting lots this crashes on Crashlytics.
to...@gmail.com <to...@gmail.com> #7
I have the same problem. Android 12 and especially Samsung and OnePlus phones.
co...@gmail.com <co...@gmail.com> #8
Same problem here, any solution or workaround would be greatly appreciated
sa...@gmail.com <sa...@gmail.com> #9
any update on this?
md...@gmail.com <md...@gmail.com> #11
same issue any update on this one ?
ko...@gmail.com <ko...@gmail.com> #12
Considering that Google didn't fix this pre-Work Manager, I doubt they will fix it in the WorkManager implementation.
-https://issuetracker.google.com/issues/76112072
They basically said this is intentional and working as intended.... seriously....
-https://issuetracker.google.com/issues/76112072#comment36
-
They basically said this is intentional and working as intended.... seriously....
-
ap...@google.com <ap...@google.com> #13
Project: platform/frameworks/support
Branch: androidx-main
commit 60f6bc31bf7258d14ccdd509f44cac4b7b6a0a36
Author: Sergey Vasilinetc <sergeyv@google.com>
Date: Thu Mar 07 23:43:04 2024
Avoid redundant posting to main thread in SystemForegroundService
`startForeground`, `cancelNotification` & `notify` are called
from the onStartCommand and onExecuted methods in SystemForegroundDispatcher
that are called on main thread anyway, so we don't need additional jumps
Additionally SystemForegroundDispatcher#handleNotify was rewritten in such way
that startForeground() is always explicitly called at the end. It is done because
startForeground() must be called for every matching parent startForegroundService()
call. After this rewrite it is easier to reason about `startForeground` call.
bug: 254846063
Test: integration app works
Change-Id: I1cdab9bd7d2c70c1acb862db8489f30c0a1ee6fc
M work/work-runtime/src/androidTest/java/androidx/work/impl/foreground/SystemForegroundDispatcherTest.kt
M work/work-runtime/src/main/java/androidx/work/impl/foreground/SystemForegroundDispatcher.java
M work/work-runtime/src/main/java/androidx/work/impl/foreground/SystemForegroundService.java
https://android-review.googlesource.com/2519903
Branch: androidx-main
commit 60f6bc31bf7258d14ccdd509f44cac4b7b6a0a36
Author: Sergey Vasilinetc <sergeyv@google.com>
Date: Thu Mar 07 23:43:04 2024
Avoid redundant posting to main thread in SystemForegroundService
`startForeground`, `cancelNotification` & `notify` are called
from the onStartCommand and onExecuted methods in SystemForegroundDispatcher
that are called on main thread anyway, so we don't need additional jumps
Additionally SystemForegroundDispatcher#handleNotify was rewritten in such way
that startForeground() is always explicitly called at the end. It is done because
startForeground() must be called for every matching parent startForegroundService()
call. After this rewrite it is easier to reason about `startForeground` call.
bug: 254846063
Test: integration app works
Change-Id: I1cdab9bd7d2c70c1acb862db8489f30c0a1ee6fc
M work/work-runtime/src/androidTest/java/androidx/work/impl/foreground/SystemForegroundDispatcherTest.kt
M work/work-runtime/src/main/java/androidx/work/impl/foreground/SystemForegroundDispatcher.java
M work/work-runtime/src/main/java/androidx/work/impl/foreground/SystemForegroundService.java
re...@gmail.com <re...@gmail.com> #14
When (which version) will this set of fixes be available?
re...@gmail.com <re...@gmail.com> #16
#13 commit 60f6bc31bf7258d14ccdd509f44cac4b7b6a0a36
released in v2.10.0-alpha-2
did not solve the problem :(
Might be worth mentioning that it only occurs on Android12 and below.
le...@3ss.tv <le...@3ss.tv> #17
Still not fixed. Would be nice to finally have a proper fix for this.
th...@gmail.com <th...@gmail.com> #18
Still not fixed
re...@gmail.com <re...@gmail.com> #19
confirmed, we also get this with periodic worker using WorkManager.
we override getForegroundInfo() to provide a notification (required for running on Android < 11), it appears that it runs as a foregroundService but doesn't call startForeground() as required.
we override getForegroundInfo() to provide a notification (required for running on Android < 11), it appears that it runs as a foregroundService but doesn't call startForeground() as required.
an...@pikasoft.co.uk <an...@pikasoft.co.uk> #20
We get this too
[Deleted User] <[Deleted User]> #21
same for me
co...@funambol.com <co...@funambol.com> #22
Same issue here, several users impacted. Do you have any plan to properly fix it?
sa...@mygate.in <sa...@mygate.in> #23
Any update on this issue?
Description
We are seeing users spiking a crash related to long-running workers. Sometimes the internal foreground service will cause the
ForegroundServiceDidNotStartInTimeException
. This is now one of our top crashes and please take a look, thanks.Stacktrace
Code snippet of setting up long-running