[#13076][fix] Destroy torch distributed process groups on PyExecutor shutdown - #12993
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
f2917bb to
d776e83
Compare
|
/bot run |
|
PR_Github #43446 [ run ] triggered by Bot. Commit: |
|
PR_Github #43446 [ run ] completed with state
|
|
/bot run |
|
As far as i can tell the failures are all import errors that are not related to this PR. |
|
/bot run --disable-fail-fast |
|
PR_Github #44994 [ run ] triggered by Bot. Commit: |
d776e83 to
8cd8549
Compare
|
PR_Github #44994 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #44997 [ run ] triggered by Bot. Commit: |
|
PR_Github #44997 [ run ] completed with state
|
Head branch was pushed to by a user without write access
8cd8549 to
c64c373
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #45248 [ run ] triggered by Bot. Commit: |
|
PR_Github #45248 [ run ] completed with state
|
|
PR_Github #46525 [ run ] triggered by Bot. Commit: |
|
PR_Github #46525 [ run ] completed with state
|
2d4ce9e to
583ed20
Compare
|
/bot run |
|
PR_Github #47137 [ run ] triggered by Bot. Commit: |
|
PR_Github #47137 [ run ] completed with state
|
583ed20 to
f3ee7ff
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #47402 [ run ] triggered by Bot. Commit: |
|
PR_Github #47402 [ run ] completed with state
|
f3ee7ff to
7e7b55d
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #47751 [ run ] triggered by Bot. Commit: |
|
PR_Github #47751 [ run ] completed with state |
trtllm-serve with --backend pytorch and TP>1 hits SIGABRT during shutdown: the HTTP layer stops cleanly but the process aborts during NCCL/CUDA teardown. PyExecutor.shutdown() tears down model engines, CUDA graphs, and resource managers, but never calls torch.distributed.destroy_process_group(). This leaves NCCL communicators to be torn down non-deterministically by Python GC after MPI session shutdown, racing against CUDA context destruction. Add destroy_process_group() in GenerationExecutorWorker.shutdown() (the MPI/standalone worker), after engine cleanup but before MPI teardown. The call is placed here rather than in PyExecutor because PyExecutor does not own the process group — in the Ray executor path, RayWorkerWrapper owns the process group and PyExecutor is a tenant inside it. Destroying the default group from PyExecutor.shutdown() would break subsequent Ray worker calls. Signed-off-by: jbernloehr <jbernloehr@nvidia.com>
7e7b55d to
d410d6c
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #48193 [ run ] triggered by Bot. Commit: |
|
PR_Github #48193 [ run ] completed with state
|
|
/bot skip --comment "test_fp8_blockscale[throughput_mtp_trtllm] passed on previous pipelines of this PR, it's flaky. unittest/kv_cache_manager_v2_tests/ was fixed by #14140, and also passed in a previous pipeline of this PR" |
|
PR_Github #48989 Bot args parsing error: Failed to parse bot args |
|
/bot skip --comment "all failing tests previously passed with the same changes" |
|
PR_Github #48991 [ skip ] triggered by Bot. Commit: |
|
PR_Github #48991 [ skip ] completed with state |
…cutor shutdown (NVIDIA#12993) Signed-off-by: jbernloehr <jbernloehr@nvidia.com>
…cutor shutdown (NVIDIA#12993) Signed-off-by: jbernloehr <jbernloehr@nvidia.com>
Summary
trtllm-servewith--backend pytorchand TP>1 hitsAborted!(SIGABRT) during shutdownPyExecutor.shutdown()tears down model engines, CUDA graphs, and resource managers, but never callstorch.distributed.destroy_process_group(), leaving NCCL communicators to be torn down non-deterministically by Python GC after MPI session shutdown, racing against CUDA context destructiondestroy_process_group()at the end ofPyExecutor.shutdown(), after all model/resource cleanup but before MPI teardownReproduction
trtllm-servewith--backend pytorch,--tp_size 4, viampirunAborted!after "Application shutdown complete" / "Finished server process"Test plan
Aborted!during shutdown🤖 Generated with Claude Code
Summary by CodeRabbit