fix(core): allocate standalone WebSocket ports atomically - #520
Open
webfansplz wants to merge 3 commits into
Open
fix(core): allocate standalone WebSocket ports atomically#520webfansplz wants to merge 3 commits into
webfansplz wants to merge 3 commits into
Conversation
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a race condition in standalone WebSocket port selection for Vite DevTools by removing probe-before-bind logic and relying on the underlying Devframe WS transport to bind atomically (port 0 → OS-assigned port), then publishing the resolved endpoint for remote docks.
Changes:
- Remove
get-port-pleasepre-allocation and delegate default standalone port selection to the Devframe transport. - Await transport readiness and read back the actual bound port from
transport.address(). - Publish the resolved WS endpoint and re-emit remote dock update events once the endpoint is known.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
webfansplz
force-pushed
the
fix/race-safe-ws-port-allocation
branch
from
August 6, 2026 04:35
f054ea3 to
932e70b
Compare
webfansplz
marked this pull request as ready for review
August 6, 2026 04:37
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.
Vite DevTools previously selected a standalone WebSocket port with
get-port-pleasebefore starting the server. Concurrent processes could probe the same available port and then race to bind it, causing all but one to fail withEADDRINUSE.Default port allocation is now delegated to the Devframe transport, which binds to port
0and lets the operating system select and reserve an available port atomically.Changes
Standalone environments that require a stable port can continue to configure
websocket.portexplicitly.Waitting for devframes/devframe#171, Fix #517