Repository navigation
Fix flaky TCPServer functional specs that listen on localhost - #127
Merged
Watson1978 merged 1 commit intoOct 21, 2026
Merged
Conversation
unused_port only checks IPv4, but a server on "localhost" binds ::1 first. These examples only detach their servers, so a ::1 listener can stay open on a port that unused_port returns again. The next server then falls back to 127.0.0.1, while the client still connects to the stale ::1 listener and the data never arrives. Use 127.0.0.1 on both sides, as the other examples in this file do. 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.
The
TCPServerfunctional examples listen and connect on"localhost", which resolves to::1first, whileunused_portonly checks IPv4. Those examples only detach their servers, so a::1listener can stay open on a port thatunused_portreturns again. The next server then falls back to127.0.0.1, the client connects to the stale::1listener, and the example fails after about 60 seconds, as in this job. This uses127.0.0.1on both sides, as the other examples in the file do.Types of Changes
Contribution
🤖 Generated with Claude Code