Repository navigation
Conversation
… remove UDP port TOCTOU Eliminate all remaining freeUdpPort() / probe-close-rebind UDP port TOCTOU races across pion/station-host/tests/e2e/ and pion/station-host/tests/peers.mjs (same root cause fixed for station/test/ in #10488): - fault-move-and-connects.test.ts & fault-runtimes-and-lend.test.ts: bind STILLFAIL_MESH_BIND_ADDR=127.0.0.1:0, parse OS-assigned port via meshPort(), push peers over the mock control plane (pushAll()), and wait for cloud.json peers convergence. - live-p5-3.test.ts: start beta on 127.0.0.1:0 first, read its bound port via meshPort(), then write alpha's cloud.json with beta's real address and start alpha on 127.0.0.1:0. - cross-engine-harness.ts, cross-engine-move.test.ts & cross-engine-move-items.test.ts: add controlPlane().pushPeers() and Twins.wirePeers() with station(..., { peer: true }) binding 127.0.0.1:0. - peers.mjs: bind 127.0.0.1:0 in both tests; in test 1 parse each booted/restarted host's bound mesh port from stderr, push updated peers via the presence WebSocket, and wait for live peers' cloud.json convergence. Co-authored-by: zuozijian <zuozijian@cue.surf>
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.
Summary
Follow-up to #10488 removing all remaining
freeUdpPort()/ UDP probe-close-rebind TOCTOU allocations acrosspion/station-host/tests/e2e/andpion/station-host/tests/peers.mjs:pion/station-host/tests/e2e/fault-move-and-connects.test.ts&pion/station-host/tests/e2e/fault-runtimes-and-lend.test.ts:freeUdpPort()withSTILLFAIL_MESH_BIND_ADDR=127.0.0.1:0, parse each launched station's OS-assigned port viameshPort(), push updated peer addresses viapushAll()once both stations are online and connected at the mock control plane, and wait for both stations'mesh/cloud.jsonpeersto reflect the bound ports.pion/station-host/tests/e2e/live-p5-3.test.ts:freeUdpPort()by launchingbetafirst on127.0.0.1:0, reading its bound port viameshPort(), writingalpha'scloud.jsonwithbeta's real port, and launchingalphaon127.0.0.1:0.pion/station-host/tests/e2e/cross-engine-harness.ts,cross-engine-move.test.ts,cross-engine-move-items.test.ts:controlPlane().pushPeers()andTwins.wirePeers(stations)+Twins.station(kind, { peer: true })so both Node and Pion stations bind127.0.0.1:0and learn each other's real ports through the control plane; removefreeUdpPort().pion/station-host/tests/peers.mjs:createSocket("udp4")probe-close-rebind sites (initial boot,betarestart, and single-stationSIGTERMtest); bind127.0.0.1:0, capturemesh listeningfrom stderr while forwarding stderr toprocess.stderr, push updatedstateto all open presence sockets, and wait for live peers'mesh/cloud.jsonconvergence.Verification
node --checkpassed on all 7 modified.ts/.mjsfilesgit grep -n "freeUdpPort" -- pion/ station/: 0 matches remainingnode scripts/agents-paths.ts: passedpion-station-mainruns all affected suites (station-host-e2emoves,copies,live-peers, andstation-host-engines)Models used: Gemini 4 Neon, Claude Opus 5.5 (independent review).
Test frameworks: Node
node:test,pion-station-maine2e & cross-engine CI suites.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.