Skip to content

fix(desktop): start Xvfb with -noreset so overlapping clients survive - #204

Merged
ElbertePlinio merged 1 commit into
mainfrom
fix/201-xvfb-noreset
Sep 25, 2026
Merged

ElbertePlinio merged 1 commit into
mainfrom
fix/201-xvfb-noreset

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Closes #201

The CI failure was not a slow window. The stack points at execApp's first listWindows (apps.ts:259), which runs before zenity is started, while the concurrent desktopWait window wait did not reject and polled for its full 8 s. That accounts for the 9.17 s. So the display was alive, and one xdotool connection was refused.

Cause: session Xvfb ran without -noreset. Xvfb then regenerates whenever its last running client disconnects, and the reset closes every client still in its connection handshake. When the window wait's xdotool exits while execApp's xdotool is mid-handshake, the second one fails with a bare "Can't open display". A connected, not yet set-up client is killed by a reset every time; the race is just how often that timing comes up, which load makes more likely.

Local evidence: Xvfb regenerated 150 times in 150 client bursts without the flag and once with it. A raw socket held mid-handshake across one xdotool run gets a broken pipe without -noreset and a successful setup reply with it.

Change: buildXvfbArgs adds -noreset; it is the only Xvfb spawn site, so desktop and browser sessions both get it. Nothing in the code depends on server resets. A new live test in integration.test.ts holds a connection mid-handshake across a short-lived xdotool client and expects a successful setup reply. It fails in under a second with the flag removed and passes with it.

On the issue checklist: the 8 s window budget did not cause this failure, so it is unchanged, and no retries or skips were added. Capturing the Xvfb log in this test is no longer needed to tell the two candidates apart.

Verification in a worktree at 80cb7de: lint, typecheck, build and PickCheck pass. Full bun run test and bun run test:coverage each had one unrelated failure (core/test/containment.test.ts "kernel thread" in one run, android/test/emulator.test.ts AVD lock in the other). Another test suite was running on the same host at the time, and each of those tests passes 3 of 3 when run alone on both this branch and main.

Without -noreset Xvfb resets when its last running client disconnects
and closes every client still in its connection handshake. Two
overlapping short-lived clients, such as a window wait's xdotool and
execApp's first xdotool, then fail with "Can't open display" (#201).
@ElbertePlinio
ElbertePlinio merged commit ec04bad into main Sep 25, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/201-xvfb-noreset branch September 25, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

screenshot-wait-live window wait fails with an unopenable display at its 8 s deadline in CI

1 participant