Conversation
wpt serve and wptrunner choose automatic ports by binding temporary sockets and closing them before starting the servers. Another listener can claim an HTTP port between configuration and startup, causing the server process to fail with EADDRINUSE. Keep automatically allocated HTTP, HTTPS, and HTTP/2 sockets bound until their server processes adopt them. Allocate on the address the server will use, exclude explicitly configured ports, and transfer raw sockets so TLS setup still happens in the server process. Apply the same handoff to the temporary HTTP server used to check subdomains. Reservations remain separate from the serializable configuration. The configuration builder closes unclaimed sockets on exit or configuration failure; startup closes parent copies after transfer and releases reservations for disabled servers. Forked children close reservations belonging to other servers so those ports do not remain occupied by unrelated processes. Do not listen on reserved sockets until the HTTP server initializes: wptrunner uses a successful TCP connection as a readiness check. Avoid SO_REUSEADDR while reserving a port, since it can allow competing binds before listen; use SO_EXCLUSIVEADDRUSE on Windows. Co-authored-by: codex <codex@openai.com>
wpt-pr-bot
requested review from
DanielRyanSmith,
jcscottiii,
jgraham and
jonathan-j-lee
October 4, 2026 09:02
domenic
added this pull request to stack #63247
October 4, 2026 09:06
This branch has not been deployed
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.
Keep automatically allocated HTTP-family ports bound through server startup, following up on port-collision failures in jsdom's use of
wpt serve.Stacked on #63245 using GitHub's stacked pull requests feature.
This is part of a series of PRs to try to fix port-allocation races that jsdom has encountered while using
wpt serve. I asked GPT-6 Astra Extra High to extract them into small, reviewable fixes, but I'm still not much of an expert in this code, so please review carefully.This one is the complicated one, certainly.