fix(imap): handle cached client error and close events safely - #64
Open
Seger85 wants to merge 1 commit into
Open
fix(imap): handle cached client error and close events safely#64Seger85 wants to merge 1 commit into
Seger85 wants to merge 1 commit into
Conversation
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.
Summary
Handle ImapFlow
errorandcloseevents for cached IMAP clients so connection failures cannot become unhandled EventEmitter errors and stale client events cannot invalidate a newer replacement connection.What changes
errorlistener to each cached ImapFlow clientcloselistener to invalidate a disconnected cached clienterrorfrom escaping that pathWhy
Node treats an emitted EventEmitter
errorwithout a listener as an uncaught exception. A long-running IMAP connection can encounter socket/network failures, so the connection manager needs to own that event lifecycle explicitly.The identity check is important: an old client may emit
closeorerrorafter a replacement has already been cached. Such a stale event must not remove the new healthy client.Validation
Validated from repository base
99ce431aa81dd4cafc2879bd35b6ee3acd0f2d74on Node 24 as part of the combined production candidate:tsc --noEmit: passedsrc: passedThis PR is intentionally separate from the HTTP session/heap lifecycle fix in #63.