Skip to content

🐞Workmanager().registerOneOffTask no more runs the task immediately and now cancelling tasks as failed after 30 seconds #738

Description

@absar

Please reopen #732 since it's not fixed, rather the 30 seconds watch dog is cancelling even recurring tasks. Same is the case with expedited and foreground service tasks. It looks like an issue on dart side, since experiencing the same issue on iOS.

The issue still remains after upgrading to workmanager 0.10.9 and workmanager_android 0.10.8
Reproduction steps remain the same as in #732
The only difference is now the log contains one additional entry which suggests somehow the job is auto cancelled. Note the app is in the foreground. If you cant reproduce the issue, press the Register OneOff Task button again:

W/JobInfo ( 8750): Requested important-while-foreground flag for job20 is ignored and takes no effect
D/WM-SystemJobScheduler( 8750): Scheduling work ID af669ab4-ab24-41ac-aa04-562427276d19Job ID 20
D/WM-GreedyScheduler( 8750): Starting work for af669ab4-ab24-41ac-aa04-562427276d19
D/WM-Processor( 8750): Processor: processing WorkGenerationalId(workSpecId=af669ab4-ab24-41ac-aa04-562427276d19, generation=0)
D/WM-WorkerWrapper( 8750): Starting work for dev.fluttercommunity.workmanager.BackgroundWorker
D/WM-SystemJobService( 8750): onStartJob for WorkGenerationalId(workSpecId=af669ab4-ab24-41ac-aa04-562427276d19, generation=0)
I/om.abc.xyz( 8750): AssetManager2(0x7e01c5c23e38) locale list changing from [] to [en-US]
D/WM-Processor( 8750): Work WorkGenerationalId(workSpecId=af669ab4-ab24-41ac-aa04-562427276d19, generation=0) is already enqueued for processing

After a few seconds this log appears but the job does not run the callback:

I/WM-WorkerWrapper( 8750): Worker result FAILURE for Work [ id=af669ab4-ab24-41ac-aa04-562427276d19, tags={ dev.fluttercommunity.workmanager.BackgroundWorker } ]
D/WM-Processor( 8750): Processor af669ab4-ab24-41ac-aa04-562427276d19 executed; reschedule = false
D/WM-SystemJobService( 8750): af669ab4-ab24-41ac-aa04-562427276d19 executed on JobScheduler
D/WM-GreedyScheduler( 8750): Cancelling work ID af669ab4-ab24-41ac-aa04-562427276d19
D/WM-SystemJobService( 8750): onStopJob for WorkGenerationalId(workSpecId=af669ab4-ab24-41ac-aa04-562427276d19, generation=0)

Activity

  1. added a commit that references this issue on Sep 7, 2026
    e8478ab
  2. ened commented on Sep 7, 2026

    @ened
    Collaborator

    Root cause found and fixed in #739: the Pigeon migration inverted the handshake, so the task could be sent to Dart before the isolate was ready — the callback never ran and the watchdog then failed the worker. The fix re-inverts it (Dart-initiated). Shipping in 0.10.10 — please retest when it's out.

  3. added a commit that references this issue on Sep 7, 2026
    02764be
  4. absar commented on Sep 9, 2026

    @absar
    ContributorAuthor

    Hi @ened retested using v0.10.10, issue is still not fixed:
    Before closing the issue could we please run the example app to check whether the fix is working preferably on an Android 16+ devices or emulator, since just the unit tests might not be enough for real device/emulator issues.

    W/JobInfo ( 7318): Requested important-while-foreground flag for job1 is ignored and takes no effect
    D/WM-SystemJobScheduler( 7318): Scheduling work ID 53748bde-74ff-49b2-8632-2616eba8a592Job ID 1
    D/WM-GreedyScheduler( 7318): Starting work for 53748bde-74ff-49b2-8632-2616eba8a592
    D/WM-Processor( 7318): Processor: processing WorkGenerationalId(workSpecId=53748bde-74ff-49b2-8632-2616eba8a592, generation=0)
    D/WM-WorkerWrapper( 7318): Starting work for dev.fluttercommunity.workmanager.BackgroundWorker
    D/WM-SystemJobService( 7318): onStartJob for WorkGenerationalId(workSpecId=53748bde-74ff-49b2-8632-2616eba8a592, generation=0)
    D/WM-Processor( 7318): Work WorkGenerationalId(workSpecId=53748bde-74ff-49b2-8632-2616eba8a592, generation=0) is already enqueued for processing

    After a few seconds the task gets cancelled without even running the callback:
    I/WM-WorkerWrapper( 7318): Worker result FAILURE for Work [ id=53748bde-74ff-49b2-8632-2616eba8a592, tags={ dev.fluttercommunity.workmanager.BackgroundWorker } ]
    D/WM-Processor( 7318): Processor 53748bde-74ff-49b2-8632-2616eba8a592 executed; reschedule = false
    D/WM-SystemJobService( 7318): 53748bde-74ff-49b2-8632-2616eba8a592 executed on JobScheduler
    D/WM-GreedyScheduler( 7318): Cancelling work ID 53748bde-74ff-49b2-8632-2616eba8a592
    D/WM-SystemJobService( 7318): onStopJob for WorkGenerationalId(workSpecId=53748bde-74ff-49b2-8632-2616eba8a592, generation=0)
    D/WindowOnBackDispatcher( 7318): setTopOnBackInvokedCallback (unwrapped): android.app.Activity$$ExternalSyntheticLambda0@5628e2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions