[https://nvbugs/6480574][fix] mpi_session: guard MpiPoolSession.shutdown against partial init#16613
Conversation
📝 WalkthroughWalkthroughChangesMPI session updates
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
|
/bot run --disable-fail-fast |
|
PR_Github #60349 [ run ] triggered by Bot. Commit: |
|
PR_Github #60349 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #60380 [ run ] triggered by Bot. Commit: |
|
PR_Github #60380 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #60420 [ run ] triggered by Bot. Commit: |
|
PR_Github #60420 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #60600 [ run ] triggered by Bot. Commit: |
|
PR_Github #60600 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #60624 [ run ] triggered by Bot. Commit: |
…own against partial init MpiPoolSession.shutdown() reads self.n_workers (in a log line) and self._wait_shutdown unguarded, but shutdown() is reachable on a session that never completed __init__: - from __del__ -> shutdown_abort() -> shutdown() on a partially-constructed object, and - from the released-session path, e.g. tests/unittest/executor/test_proxy_fast_death.py::test_pool_session_shutdown_never_blocks_after_release, which builds the object with MpiPoolSession.__new__(MpiPoolSession). In those states the attributes are absent and shutdown() raises AttributeError: 'MpiPoolSession' object has no attribute 'n_workers' (then '_wait_shutdown'). Guard both accesses with getattr(...), matching the existing _pool_dead guard, so a released or partially-constructed session shuts down cleanly instead of raising. No behavior change for fully-initialized sessions (n_workers / _wait_shutdown are always set by __init__; the guards only affect objects that bypass it). Also remove the temporary waiver for that test (nvbugs/6480574) so CI re-validates the now-fixed test. Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
f036089 to
299930b
Compare
|
Rebased onto latest main and removed the temporary waiver for This PR is the fix for nvbugs/6480574 / TRTLLM-14480. Empirical confirmation of the fix from recent CI on the same test:
The failure is a cross-PR merge skew (unguarded |
|
/bot run --disable-fail-fast |
|
PR_Github #60644 [ run ] triggered by Bot. Commit: |
|
PR_Github #60624 [ run ] completed with state |
|
Closing in favor of #16630 by @JunyiXu-nv (the nvbugs/6480574 assignee), which fixes the same failure test-side by seeding the For the record, empirical CI confirmation of the root cause (same test): build |
|
PR_Github #60644 [ run ] completed with state
|
Summary
MpiPoolSession.shutdown()readsself.n_workers(in a log line) andself._wait_shutdownunguarded, but it is reachable on a session that never completed__init__:__del__→shutdown_abort()→shutdown()on a partially-constructed object, andtests/unittest/executor/test_proxy_fast_death.py::test_pool_session_shutdown_never_blocks_after_release, which builds the object withMpiPoolSession.__new__(MpiPoolSession).In those states the attributes are absent and
shutdown()raisesAttributeError: 'MpiPoolSession' object has no attribute 'n_workers'(then... '_wait_shutdown'). The_pool_deadcheck immediately above already usesgetattr(self, '_pool_dead', False)defensively for exactly this reason.Fix
Guard both accesses with
getattr(...), matching the existing_pool_deadstyle, so a released or partially-constructed session shuts down cleanly instead of raising.Why main is currently red
This is a cross-PR merge skew, each half green on its own:
self.n_workerslog line was added by [None][test] disagg startup: detect and fail fast on worker OOM/crash #16456 (2026-07-16), and__new__-based test that trips it was added by [TRTLLM-13409][fix] make proxy shutdown non-blocking when the engine is dead #16312 (2026-07-20).Neither failed in isolation; the combination on
mainfails deterministically.mainhas been red ontest_pool_session_shutdown_never_blocks_after_releasesince #16312 landed, and the fix is a small robustness guard.Test
test_proxy_fast_death.pynow passes in full (23 passed, was 1 failed):(No behavior change for fully-initialized sessions:
n_workers/_wait_shutdownare always set by__init__; the guards only affect objects that bypass it.)🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Bug Fixes