Repository navigation
Conversation
HostConnection.close() cleared the pending-request map without settling the promises in it, and the socket's close handler then returned early because the connection was already marked closed. A request still waiting for its reply when close() was called never resolved or rejected, so its caller waited forever. close() now rejects them with EGO_TASK_HOST_DISCONNECTED, the error a dropped socket already produces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
HostConnection.close()left requests that were still waiting for a reply pending forever. It now rejects them withEGO_TASK_HOST_DISCONNECTED, the error a dropped socket already produces.Related issue
None: issues are disabled on this repository.
Changes
close()cleared thependingmap without settling the promises in it. The socket'sclosehandler, which normally rejects them, returns early when the connection is already marked closed. A caller awaitingconn.request(...)whenclose()ran therefore never resolved or rejected.close()now calls the existingfailAll()withEGO_TASK_HOST_DISCONNECTEDbefore destroying the socket. A secondclose()stays a no-op, and requests made afterclose()still reject as before.To reproduce, connect to a socket server that accepts requests and never replies, send two requests, and call
close(): onmain, both promises stay pending.Verification
Run from
package/ego-linux-host.mainnpm test(build, typecheck, tests)main's sourceunfinished requests remained pending after closeThe 3 skipped tests need a real browser environment and skip themselves on both.
Impact
No public API change. A caller whose request is cut short by
close()now gets anEGO_TASK_HOST_DISCONNECTEDerror instead of waiting forever.🤖 Generated with Claude Code