-
Notifications
You must be signed in to change notification settings - Fork 5
25s Timeout in Android #30
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?
All reactions
-
❤️ 1 -
👀 1
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
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!
All reactions
-
❤️ 1
Thanks for the fast bugfix! It works as expected. :)
All reactions
-
🎉 1