Repository navigation
test(cloudxr): fix flaky terminate race in test_background.py - #1327
Conversation
test_sigterm_and_clears_the_pid_file intermittently failed with "assert False is True" from terminate(). Its stand-in for the service, `python -m time run 30`, never slept: a builtin module has no code object, so the child exited within milliseconds. The test passed only if terminate() read /proc/<pid>/cmdline before then; a short stall on a loaded CI runner found a zombie with an empty cmdline instead, so read_pid() returned None. Unrelated to the CloudXR runtime, which this code path never loads. Add a stand_in_service fixture that runs a module sleeping for its last argument, and use it in the three tests that relied on `-m time`. Move the cmdline poll from #1209 into _poll_read_pid() and wait on it before terminate(), since a fresh child's cmdline can still be empty when Popen() returns. Record both pitfalls in tests/AGENTS.md. Reproduced by stalling 50 ms after spawn(): the old test fails as on CI, the new one passes. Signed-off-by: Jakob Bornecrantz <tbornecrantz@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Summary The fix is correct and well scoped. The old stand-in ( Legend: 🚫 Blocker · 💡 Suggestion · 🔍 Nit
Actionables (for bots — copy-paste-ready for AI)
|
gareth-morgan-nv
left a comment
There was a problem hiding this comment.
LGTM see agent review above
Description
test_sigterm_and_clears_the_pid_file intermittently failed with "assert False is True" from terminate(). Its stand-in for the service,
python -m time run 30, never slept: a builtin module has no code object, so the child exited within milliseconds. The test passed only if terminate() read /proc//cmdline before then; a short stall on a loaded CI runner found a zombie with an empty cmdline instead, so read_pid() returned None. Unrelated to the CloudXR runtime, which this code path never loads.Add a stand_in_service fixture that runs a module sleeping for its last argument, and use it in the three tests that relied on
-m time. Move the cmdline poll from #1209 into _poll_read_pid() and wait on it before terminate(), since a fresh child's cmdline can still be empty when Popen() returns. Record both pitfalls in tests/AGENTS.md.Reproduced by stalling 50 ms after spawn(): the old test fails as on CI, the new one passes.
Type of change
Testing
Checklist
SKIP=check-copyright-year pre-commit run --all-filesgit commit -s) per the DCOSummary by CodeRabbit