fix: release port 1455 when OAuth server fails to bind#124
Closed
tryHivemind wants to merge 1 commit into
Closed
Conversation
Fixes #102 - when the server errored on listen (e.g. EADDRINUSE), server.close() was only returned in the close() callback for later use, but never called immediately. This left the port claimed, causing subsequent auth attempts to also fail and localhost:1455 to refuse connections. Added server.close() in the error handler before resolving.
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
Fixes #102 — when
http.Serveremits anerrorevent on.listen()(e.g.EADDRINUSEbecause another process holds port 1455), the error handler was resolving the promise withready: falsebut never callingserver.close(). This left the port in a half-open state, so the OS kept it claimed even though we gave up on it. Any subsequent auth attempt would also fail to bind, and the callback URLhttp://127.0.0.1:1455would refuse connections.Root cause in
lib/auth/server.ts:Test plan
nc -l 1455), then runopencode auth login→ should fall back to manual paste without hanging