You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flaky: desktop-linux teardown asserts pid gone before the zombie is reaped #79
Main run 33794016944 for ea42c24 (#78, Rust and docs only) failed one test:
packages/desktop-linux/test/integration.test.ts
desktop integration (Xvfb + xdotool) > runs an xvfb session and screenshots the display
AssertionError: expected true to be false (integration.test.ts:552)
The same test passed on #78's own PR run minutes earlier and on the previous five main runs.
Cause
Line 552 asserts isPidAlive(session.xvfbPid) is false right after destroyDesktopSession returns.
destroyDesktopSession stops Xvfb through stopProcessGroupVerified in packages/core/src/proc.ts, which returns terminated when the group is empty and the leader is gone or is a zombie (state === "Z"). That is deliberate: the child is reaped asynchronously by whoever spawned it.
isPidAlive is process.kill(pid, 0), which succeeds for a zombie. So there is a window between "verified terminated" and "reaped" where the assertion sees true.
The teardown is correct. The assertion measures a different thing than the teardown guarantees.
Fix options
In the test, poll isPidAlive for a short deadline instead of asserting once, or assert on /proc/<pid>/stat not being a live (non-Z) process, matching what stopProcessGroupVerified verifies.
Or have destroyDesktopSession wait for the spawned child's exit event when it owns the handle, so the pid is reaped before it returns. Larger change, and it only helps when the destroyer is also the spawner.
The first option is a test-only change and is the one I would take.
Activity
fix: stabilize desktop and browser integration tests (#90)