Repository navigation
test(desktop-linux): stop display, port and session collisions under load - #256
Merged
Merged
Conversation
…display Xvfb creates its lock and socket before startup ends, so file presence raced a server that was still starting. Wait until the lock names the child, the child holds the listed socket, and the server answers an X11 setup request. Keep the server inside try/finally and report its stderr if it exits. Refs #252.
takeover.test.ts walked fixed ports from 15901 and display-identity.test.ts used :242, so two concurrent suites collided. The second run saw "already in use", a fake x11vnc that crashed on bind, or a lost-race XvfbStartError. Pick a free loopback port below the local port range and an unused display at random instead. Refs #252.
A test that exceeds its timeout keeps running after vitest moves on. afterAll then deleted the registry, so the test's own destroy found no session, or the worker exited first, and Xvfb outlived the run. Track every created session and destroy leftovers in afterAll before the registry goes. Also give the registry reaping test the session budget, and pick free ports and unused displays instead of fixed ones. Refs #252.
Display allocation picks the lowest free number, so a concurrent run can claim a destroyed session's display at once. isDisplayAlive then reports that new server. Assert that this session's Xvfb no longer owns the display instead. Refs #252.
The race test parses each result as soon as the file exists. Under load it read a half-written file and failed with "Unexpected end of JSON input". Write the result aside and rename it into place. Refs #252.
This was referenced Oct 6, 2026
…led teardown state Hold a per-user lock file for each picked loopback port until teardown, so concurrent suites never receive the same port before VNC binds it. A reservation whose owner process is gone counts as stale. Integration teardown now tries every tracked session and keeps the registry when any destroy fails. The display allocation tests reuse the shared unused display picker, and a redundant release assertion is dropped.
…rge/pickforge into fix/252-desktop-linux-load-flakes
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 desktop-linux display, integration, takeover and identity tests no longer collide when two runs share a host, and they no longer leak a session's Xvfb when a test times out.
The live unrelated server test now waits until the lock names the spawned Xvfb, that Xvfb holds the socket, and the server answers an X11 setup request. File presence alone was not enough. Takeover, display-identity and integration used fixed VNC ports and displays, so they now pick a free port and an unused high display per run. Integration sessions are tracked, and
afterAllwaits for creates still in progress and destroys leftover sessions before it deletes the registry. That closes the timed-out-test leak. The destroy check now asks whether this session's Xvfb still owns the display, because a concurrent run may take the freed number at once. The race worker publishes its result atomically. Product code is unchanged.One leak path stays open. When a vitest worker is SIGKILLed from outside, no teardown runs. That is tracked in #253.
Closes #252
252/final-alloc-pinned/,252/after2-2x/252/before-2x/,252/after2-2x/summary.txt252/probe/reuse-probe.log252/leak-proof/leak-before.txt,leak-after.txtbun run test:coverage252/coverage.logEvidence lives in
~/Artifacts/pickforge-kickoff-2026-10-06/on the dev host. The QA pass was skipped because this is a test-only change with nothing to drive.