Repository navigation
fix(imap): do not leak an unhandled error from a pending IDLE task - #302
Merged
robert-virkus merged 1 commit intoOct 5, 2026
Merged
Conversation
disconnect() and connection errors fail every pending task. The IDLE task is sent with returnCompleter: false, so until the IDLE command has been written nobody listens to it and the error surfaces as unhandled, e.g. when IDLE waits in the queue behind a pending command. In an isolate with errorsAreFatal this terminates the isolate. Mark the task's future as handled; idleDone() still gets the result.
Member
|
Love it, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #301.
Since #288,
disconnect()and connection errors fail every pending task. The IDLE task is sent withreturnCompleter: false, so until theIDLEline has been written nobody listens to it and the error is reported as unhandled, e.g. when IDLE waits in the queue behind a pending command. In an isolate witherrorsAreFatal: truethis terminates the isolate.idleStart()now marks the task's future as handled;idleDone()and the command queue still receive the result.Tests
Two cases in
test/connection_robustness_test.dart:disconnect()and a lost connection while IDLE waits behind a pendingNOOP. Both fail onmainwith an unhandledImapException(client disconnected/connection lost: ...) and pass with the fix.dart formatanddart testare clean,dart analyzereports no new issues.