paneflow
paneflow copied to clipboard
paneflow-host tests: a failed ownership_probes attempt leaves its detached host and fixture sessions running
I was running the native Windows cargo nextest run --workspace --locked --profile ci gate for #135. While diagnosing a binary the next build could not replace, I found that a failed attempt of the_fixture_modes_are_driven_through_the_real_host_ipc leaves its detached paneflow-host.exe running, with paneflow-session-fixture.exe sessions under it.
What happened
- When: 2026-11-09, twice (08:05 and 14:56 local time), on Windows 11 26300.
- Sequence: the test failed its first attempt under load (a parallel WSL build) and passed on nextest's retry.
- Leftovers: the host from the failed attempt kept running, with its fixture sessions. Their executables in the target directory stayed open, and the test's temporary
PANEFLOW_HOMEcould not be deleted. - Recovery: stopping the processes by PID and deleting the home cleared it.
Why it leaks
- No cleanup on failure.
DetachedHost(crates/paneflow-host/tests/ownership_probes.rs:79) has noDrop. Itsstop(self)stops the live sessions and sendshost.shutdown, but it runs only as the last line of a test that passed. A failed assertion unwinds past it. - The host is detached by design.
bootstrap::ensure_host_runningstarts it withCREATE_BREAKAWAY_FROM_JOB | DETACHED_PROCESSon Windows andsetsidon unix. The kill-on-close job fromallow_breakaway_like_the_desktop_doesdoes not take it down, and neither does the exit of the test process. - Three tests are exposed:
h02_a_requester_that_disconnects_mid_create_leaves_the_host_owning_the_child,descendants_remain_recoverable_after_the_parent_exitsandthe_fixture_modes_are_driven_through_the_real_host_ipc. - Platforms: seen on Windows only, but nothing in the helper is Windows-specific.
Why the first attempt fails under load is a separate question, not diagnosed here. This issue is about what a failed attempt leaves behind.
Direction (not started)
- A
DroponDetachedHost. It would do whatstopdoes, then kill the host by PID if it is still live, asBurstHostincrates/paneflow-host/tests/restore_burst.rsalready does. - A host tied to the test's lifetime. No
Dropruns when nextest terminates a test at its 300 s timeout. To leave nothing behind on any exit path, a host started by a test could watch the process that started it and exit with it: a process handle on Windows, a pidfd on Linux,EVFILT_PROCon macOS. Check first whether the host already has a hook for this.