paneflow icon indicating copy to clipboard operation
paneflow copied to clipboard

paneflow-host tests: a failed ownership_probes attempt leaves its detached host and fixture sessions running

Open arthjean opened this issue 3 weeks ago • 0 comments

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_HOME could 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 no Drop. Its stop(self) stops the live sessions and sends host.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_running starts it with CREATE_BREAKAWAY_FROM_JOB | DETACHED_PROCESS on Windows and setsid on unix. The kill-on-close job from allow_breakaway_like_the_desktop_does does 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_exits and the_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 Drop on DetachedHost. It would do what stop does, then kill the host by PID if it is still live, as BurstHost in crates/paneflow-host/tests/restore_burst.rs already does.
  • A host tied to the test's lifetime. No Drop runs 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_PROC on macOS. Check first whether the host already has a hook for this.

arthjean avatar Nov 09 '26 16:11 arthjean