Repository navigation
Tests: a grandchild reaped while its /proc stat is read counts as gone - #14268
Conversation
test_a_timed_out_build_stops_its_whole_process_tree polls /proc/<pid>/stat for a zombie. The grandchild can be reaped between the open and the read, and that read raises ProcessLookupError (ESRCH), not FileNotFoundError, so the test failed exactly when the process had gone. Treat both as gone, in a helper with a deterministic test of that race.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1471a6c359
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @pytest.mark.skipif(os.name == "nt", reason = "POSIX process groups") | ||
| def _process_gone(pid): |
There was a problem hiding this comment.
Restore the Windows skip to the process-tree test
Move this marker back onto test_a_timed_out_build_stops_its_whole_process_tree; pytest does not apply a mark attached to an ordinary helper when that helper is called. On Windows, the formerly POSIX-only test now runs, and _process_gone() treats the missing /proc/<pid>/stat as proof that the grandchild exited, so it can pass without verifying that taskkill actually removed the process tree.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, fixed in the next commit. I inserted _process_gone between @pytest.mark.skipif(os.name == "nt", reason = "POSIX process groups") and test_a_timed_out_build_stops_its_whole_process_tree, so the mark landed on the helper, where pytest ignores it, and the test lost its Windows skip. The mark is back on the test (its pytestmark is skipif again, and the helper has none). test_kernel_install.py: 119 passed.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
studio/backend/tests/test_kernel_install.py::test_a_timed_out_build_stops_its_whole_process_treeflakes in the(Python 3.13, a-k)shard (seen on #14240):Cause
The test polls the killed grandchild until it is gone. That means
kill(pid, 0)fails, or/proc/<pid>/statshows a zombie, or that file is missing. The grandchild can be reaped between opening/proc/<pid>/statand reading it. On Linux that read raisesProcessLookupError(ESRCH), notFileNotFoundError. So the test failed exactly when the process had already gone, which is the outcome it was waiting for. The product (kernel_install.run_process_tree) is fine. The poll came in with #13971.Reproduced directly: open
/proc/<pid>/statof a live child, kill and reap it, then read. The read raisesProcessLookupError: [Errno 3] No such process.Change
Test-only:
_process_gone(pid): the same three checks, with(FileNotFoundError, ProcessLookupError)both counted as gone.test_a_process_reaped_while_its_stat_is_read_counts_as_gone: makes the race deterministic.openof the child's stat file kills and reaps the child right after opening, andkill(pid, 0)reports it alive, as at the start of the race. It is skipped where there is no procfs.Testing
studio/backend/tests/test_kernel_install.py: 119 passed.FileNotFoundError, the new test fails withProcessLookupError: [Errno 3] No such process. That is the CI failure.