vivarium: a timeout inside the guest reaches the host as the wrong error, and a pytest phase ignores its deadline · Issue #1478 · nixidae/nixidae · GitHub
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
vivarium: a timeout inside the guest reaches the host as the wrong error, and a pytest phase ignores its deadline #1478
R6: the agent runs each command in its own process group and kills the group at the timeout. The host raises GuestTimeout (a MachineError), not "guest stopped answering". wait_until_succeeds goes on past a timed-out attempt. A boot that does not end answers starting with its failed units, and the boot recipe fails on it.
R9, in part: after each test, the plugin reads the clock. A sync test past the deadline fails the phase, and no later test starts. The timeout option says the limit stops a test only at an await.
Open, needs a decision: interrupting a test that blocks in pytest's worker thread, at the deadline or on ctl stop.
PyThreadState_SetAsyncExc(worker, PhaseTimeout): stops a Python-level loop; does not break a blocking C call (time.sleep, a socket read), which raises only when it returns. Small, but partial.
pytest-timeout's thread method: dumps the stacks and calls os._exit. The run ends with no verdict, report or teardown. Not usable as is.
Run pytest in a subprocess and kill it: a real interrupt, but a redesign of the plugin (fixtures are guests on the session's loop, reached through a portal).
Recommendation: 1 now, as a best effort that also covers a stop; 3 only if a blocking C call is seen to hang a phase.
Decided (re-evaluated 2026-11-18): no interrupt of pytest's worker thread. Option 1 is withdrawn.
PyThreadState_SetAsyncExc raises only between bytecodes. A sync test that runs long almost always waits in C: in time.sleep, a socket read, or portal.call waiting on the loop. In each of those the exception lands only when the wait ends, which is when the clock check already fails the phase. A pure-Python busy loop is the only case it stops, and it brings two hazards: a thread id the OS gives to a new thread, and an exception that lands in pytest's own code and reads as an internal error.
What holds now: an async test stops at the deadline; a sync test fails the phase when it returns, and no later test starts; the timeout option says so. Option 3 (pytest in a subprocess) stays the route if a blocking test is seen to hang a phase; it gets its own issue then.
Activity
vivarium: the agent kills a timed-out command's whole process group
vivarium: a timeout in the guest raises GuestTimeout, not silence
vivarium: a boot that does not end lists its failed units
vivarium: a pytest phase fails after a sync test runs past its timeout
Lillecarl commentedon Nov 17, 2026
Landed on main (Lock … 58bc20e), each
Refs #1478:GuestTimeout(aMachineError), not "guest stopped answering".wait_until_succeedsgoes on past a timed-out attempt. A boot that does not end answersstartingwith its failed units, and the boot recipe fails on it.timeoutoption says the limit stops a test only at anawait.Open, needs a decision: interrupting a test that blocks in pytest's worker thread, at the deadline or on
ctl stop.PyThreadState_SetAsyncExc(worker, PhaseTimeout): stops a Python-level loop; does not break a blocking C call (time.sleep, a socket read), which raises only when it returns. Small, but partial.os._exit. The run ends with no verdict, report or teardown. Not usable as is.Recommendation: 1 now, as a best effort that also covers a stop; 3 only if a blocking C call is seen to hang a phase.
Assisted-By: Claude Opus 5.5
Lillecarl commentedon Nov 18, 2026
Decided (re-evaluated 2026-11-18): no interrupt of pytest's worker thread. Option 1 is withdrawn.
PyThreadState_SetAsyncExcraises only between bytecodes. A sync test that runs long almost always waits in C: intime.sleep, a socket read, orportal.callwaiting on the loop. In each of those the exception lands only when the wait ends, which is when the clock check already fails the phase. A pure-Python busy loop is the only case it stops, and it brings two hazards: a thread id the OS gives to a new thread, and an exception that lands in pytest's own code and reads as an internal error.What holds now: an async test stops at the deadline; a sync test fails the phase when it returns, and no later test starts; the
timeoutoption says so. Option 3 (pytest in a subprocess) stays the route if a blocking test is seen to hang a phase; it gets its own issue then.Closing: R6 and the rest of R9 are landed.
Assisted-By: Claude Opus 5.5