Skip to content

Navigation Menu

Sign in
Sign up

25s Timeout in Android #30

Discussion options

I’m seeing the following log in my Flutter app:

[log] [NativeWorkManager] DartWorker callback "<unknown>" timed out after 25 s.
Consider:
 • Breaking the work into smaller tasks.
...
D/DartCallbackWorker(19666): Dart callback completed: sync-nightly, result: false

It appears the DartWorker has a hard timeout of 25 seconds. Is this timeout configurable?

My background task performs a long-running operation that cannot realistically be split into smaller tasks. What are the recommended approaches in this case?

You must be logged in to vote

Hi @devroble ,

Thank you for reporting this. This issue has been fully resolved in version 1.2.7, which is now live on pub.dev.

🔍 Root Cause

Previously, the timeoutMs value configured in the DartWorker was not being correctly forwarded through the Android and iOS native bridges. Because the Dart dispatcher couldn't read the user-supplied value, it always fell back to a hardcoded safety default of 25 seconds. This caused any long-running Dart callback to be terminated prematurely, regardless of the timeoutMs configuration.

🛠 The Fix

The native bridges now properly propagate the timeoutMs field end-to-end to the Dart callback dispatcher. We've also added strict type validation to ensure the...

Replies: 1 comment 1 reply

Comment options

Hi @devroble ,

Thank you for reporting this. This issue has been fully resolved in version 1.2.7, which is now live on pub.dev.

🔍 Root Cause

Previously, the timeoutMs value configured in the DartWorker was not being correctly forwarded through the Android and iOS native bridges. Because the Dart dispatcher couldn't read the user-supplied value, it always fell back to a hardcoded safety default of 25 seconds. This caused any long-running Dart callback to be terminated prematurely, regardless of the timeoutMs configuration.

🛠 The Fix

The native bridges now properly propagate the timeoutMs field end-to-end to the Dart callback dispatcher. We've also added strict type validation to ensure the background dispatcher gracefully handles invalid timeouts (e.g., NaN, Infinity, null) by falling back to a safe budget without crashing.

✅ Resolution

Simply update your pubspec.yaml to the latest version:

dependencies:
 native_workmanager: ^1.2.7

Your custom timeoutMs budget will now be respected correctly across both background executions and foreground test paths:

NativeWorkManager.enqueue(
 taskId: 'my_long_task',
 trigger: const TaskTrigger.oneTime(),
 worker: DartWorker(
 callbackId: 'my_sync_callback',
 timeoutMs: 45000, // This will now properly lift the 25s default
 ),
);

Please upgrade to 1.2.7 and let us know if everything works as expected!

You must be logged in to vote
1 reply
Comment options

Thanks for the fast bugfix! It works as expected. :)

Answer selected by vietnguyentuan2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /