Repository navigation
[CI/Build] Bound OmniRunner teardown and clean up after a failed init - #6126
Closed
ShengleiFu wants to merge 1 commit into
Closed
ShengleiFu wants to merge 1 commit into
ShengleiFu wants to merge 1 commit into
Conversation
`iter_omni_runner` builds the runner in the `with` expression, so a constructor that fails part-way never reaches `__exit__`: none of the teardown runs, and the engine subprocesses it already started are abandoned for the interpreter to join at exit. The run then stalls with no failure reported and dies on the CI step timeout, which hides the error that started it. `__exit__` was also unbounded. `destroy_process_group()` waits on peer ranks that a mid-init failure has already killed, and `close()` carries no timeout, so a fixture can block there indefinitely. - Add `tests/helpers/deadline.py` with `run_with_deadline` (run on a daemon thread, stop waiting after a deadline, report rather than raise so a teardown failure cannot replace the error that caused it) and `build_with_cleanup` (run cleanup when a constructor raises, then re-raise the original error). Free of vllm imports so both are unit-testable without an accelerator. - Run `OmniRunner._teardown` under `TEARDOWN_DEADLINE_S`, and run the orphan sweep plus device cleanup when construction fails. - Make `_cleanup_process` a staticmethod; it never used `self`, and the failed-init path has no instance. Co-authored-by: Claude Signed-off-by: Shenglei Fu <sfu@confluent.io>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
ShengleiFu
marked this pull request as draft
August 12, 2026 21:34
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.
Purpose
A test runner whose constructor fails skips its own teardown entirely, so the run stalls with no failure reported and dies on the CI step timeout instead.
iter_omni_runnerbuilds the runner inside thewithexpression, and Python evaluates the constructor before__enter__.OmniRunner.__init__builds the engine eagerly (self.omni = Omni(...)), so when it raises,__exit__never runs: noclose(), no_cleanup_process()sweep for residualenginecoreprocesses, nocleanup_dist_env_and_memory(). The subprocesses the constructor already started are abandoned, and the interpreter joins those non-daemon children at exit. Observed on a Merge-tier build: the test errored at 3m30s on a model-asset load failure, then sat idle for 37 minutes until the 40-minute ceiling, recorded astimed_outwith exit-1— so the real exception is visible only by reading the log. Separately,__exit__is unbounded even on the success path:destroy_process_group()waits on peer ranks a mid-init failure has already killed, andclose()carries no timeout.This PR:
tests/helpers/deadline.pywithrun_with_deadline(runs on a daemon thread, stops waiting after a deadline, reports rather than raises so a teardown failure cannot replace the error that caused it) andbuild_with_cleanup(runs cleanup when a constructor raises, then re-raises the original error). Both are free of vllm imports, so they are unit-testable without an accelerator.OmniRunner._teardownunderTEARDOWN_DEADLINE_S(180s — ample for a healthy teardown, whose psutil sweep alone allows 8s; it bounds only the pathological case).cleanup_after_failed_runner_init._cleanup_processastaticmethod; it never usedself, and the failed-init path has no instance.Deliberately not included: raising Buildkite
timeout_in_minutes, or wrapping pytest in a shelltimeout. Both relabel the stall rather than fix it, and neither restores the cleanup that was skipped.Backward compatibility: no test-facing API changes.
__exit__runs the same steps in the same order, now under a deadline; the only new behaviour is cleanup on a path that previously ran none.Test Plan
vLLM Version: 0.26.0
vLLM-Omni Commit: 12f8168 (base)
pytest tests/helpers/tests/test_deadline.py -v— CPU only, no acceleratorpython -c "import tests.helpers.runtime"— the changed module still importspytest tests/e2e/offline_inference/test_bagel.py --collect-only— the fixture path still collectsthread.join()with no timeoutmainbehaviour)ruff check+ruff format --check(v0.14.10, as pinned)Test Result
tests/helpers/tests/test_deadline.py— 6 passedimport tests.helpers.runtime— clean;TEARDOWN_DEADLINE_S = 180.0test_bagel.py --collect-only— 2 tests collectedthread.join()unbounded → pytest hangs, killed at a 30s ceiling (exit 124); restored, exit 0The first mutation is the point of the change: it reproduces this failure mode in miniature — a fixture that never returns, so pytest reports nothing — in 30 seconds without a GPU.
Not reproduced end to end: the original 37-minute stall needs an H100, BAGEL-7B, and the model fetch to fail again. The claim this PR defends is narrower and provable by reading the code — the failed-init path skips teardown, and
__exit__has no upper bound.Not a duplicate: no open PR touches
iter_omni_runnerorOmniRunnerteardown, and no open issue covers a fixture stalling after a failed initialization. #5675 also editstests/helpers/, but inmedia.py's Whisper device selection — no overlap.AI assistance was used for this change (log analysis, drafting and the mutation checks). I have reviewed every changed line and run the tests reported here.