fix: add per-test-file timeout to prevent CI from hanging 12h#149
Merged
Conversation
test_model_configs.py (684 tests x 8 torchrun processes) was causing the CI job to hang for the full 12h timeout due to a deadlock in distributed process group initialization introduced by the MORI commit. Add a 30-minute timeout per test file via `timeout` so a hung test file is killed and reported as failed rather than blocking all subsequent tests and consuming the entire CI time budget.
Per review feedback: timeout sends SIGTERM first, but torchrun child processes can ignore it. Add --kill-after=300 so any processes still alive 5 minutes after SIGTERM are forcibly SIGKILLed. Also handle exit code 137 (SIGKILL) alongside 124 (SIGTERM timeout).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
timeoutwrapper around eachtorchruninvocation inrun_unit_tests.sh124(timeout) is caught and reported as a test failureTEST_TIMEOUTenv var allows overriding the limit without changing the scriptRoot Cause
test_model_configs.py(684 tests × 8 torchrun processes) was hanging for the entire 12h CI job timeout after the MORI commit (26912eb), which added early MORI shmem bootstrap and a newmori_epprocess group registration inpretrain_gpt.pyandfused_a2a.py. This appears to cause a deadlock in distributed process group initialization whentorchrun --nproc_per_node=8spawns workers for this test file.Without a per-file timeout, one hung
torchrunblocks all subsequent test files and consumes the entire 12h CI budget:22:13:36, hit 12h timeouttest_model_configs.pystarted atT+5h44mand hung for ~6h16mWhat changes
Note
The underlying deadlock in
test_model_configs.pyneeds a separate investigation. This PR ensures CI fails fast and continues running remaining test files rather than hanging until the job-level timeout kills everything.