Repository navigation
Description
System Info
- TensorRT-LLM 1.3.0rc25 (container build) and current main (83aed1a): the relevant code is identical
- Multi-node launch with
srun --mpi=pmix ... trtllm-llmapi-launch <engine command>(8 ranks, one engine process on rank 0) - Cluster scheduler: Slurm with PMIx,
KillOnBadExit=1.
Who can help?
@NVIDIA/trt-llm-runtime-devs (owners of tensorrt_llm/llmapi)
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
Run the launcher under srun --mpi=pmix -N1 -n4 with a fake engine on rank 0 that connects with
RemoteMpiCommSessionClient, submits a task in which even ranks raise and odd ranks block forever, and
then exits 1 (the same calls as tests/unittest/llmapi/_run_mpi_comm_task.py). Observed on a 4-rank
step, each case under a 75 s external timeout, with the released launcher (1.3.0rc25) and again with
the launcher script from main (83aed1a) driving the same Python:
- task raises on every rank, engine exits 1: the launcher prints
Task exit code: 1, the server logs
received shutdown signal, thenMGMN leader node exit code: 0andSubshell exit code: 1; the
rank-0 task exits 1 and the step ends in 45 to 50 s. Handled today. - task raises on ranks 0 and 2 and blocks forever on ranks 1 and 3, engine exits 1: the launcher
printsTask exit code: 1andMPI Comm server exit code: 0and nothing more; no task exits; the
step is still alive when the 75 s timeout kills it. Identical with both launcher versions. This is
the shape seen in production, where the step lived for 37 minutes until the orchestrator's health
timeout cancelled it. - no task submitted (engine exits 3 without contacting the server), and a task that returns on every
rank: both exit cleanly with the expected codes (3 and 0).
With the proposed fix applied (launcher andmpi_session.pyfrom the PR branch mounted over the
released files, same job shape): the blocked-ranks case now logsreceived shutdown signal while 4 worker future(s) are still running, then after the 20 s grace used in the test
RemoteMpiCommSessionServer: worker world did not shut down within 20.0s; calling MPI_Abort so no rank outlives the leader; all four tasks are killed by the abort and the step ends on its own after 63 s
with a non-zero exit. The other four cases are unchanged.
Expected behavior
After the rank-0 task exits non-zero, the launcher should exit non-zero within a bounded time, and no
follower rank should outlive the leader: either the leader ends the communicator with MPI_Abort, or
the rank-0 task exits non-zero so srun --kill-on-bad-exit=1 can end the step.
actual behavior
The engine process started by trtllm-llmapi-launch on rank 0 failed during executor initialization
("Executor worker returned error", every rank logged "Failed to initialize executor") and exited 1.
The launcher printed Rank0 Task exit code: 1 and, after the stop request,
Rank0 MPI Comm server exit code: 0. Then nothing: no Rank0 MGMN leader node exit code, no
Rank0 Subshell exit code, no RankN MGMN worker node exit code. The rank-0 launcher never exited,
the 7 follower launchers stayed in MPICommExecutor, and the srun step stayed alive with a dead engine
behind it for 37 minutes until the orchestrator's health timeout cancelled the step. The cluster has
KillOnBadExit=1, which did not help because no task ever exited.
additional notes
Why, from the code:
trtllm-llmapi-launchexits only after the foregroundpython3 -m tensorrt_llm.llmapi.mgmn_leader_node
returns. The--action stoprequest is a single message on the ZeroMQ control socket; its exit code
is 0 even if the server never reads it (mgmn_leader_node.py:37-51).RemoteMpiCommSessionServer.serve()reads the control socket only after every outstanding worker
future has completed (as_completedloop), and once it has read the shutdown it still waits, through
mpi4py, for every submitted task to return before the stop sentinel reaches the follower ranks
(MPICommExecutor.__exit__->client_stop). The sentinel is sent at interpreter exit, not in
serve(). If any rank is wedged, none of this completes.mgmn_worker_node.pyiswith MPICommExecutor(COMM_WORLD): the followers have no timeout and no
exit path other than that sentinel, anMPI_Abort, or a signal from the scheduler.- In this deployment mode the executor proxy's abort on init failure (
_fail_initialization->
shutdown_abort) reaches aRemoteMpiCommSessionClient, whoseshutdown_abortis a no-op, so no
MPI_Abortis ever issued.
Proposed fix:
A PR follows: (1) RemoteMpiCommSessionServer polls the control socket while worker futures are
outstanding and runs shutdown as a bounded teardown that escalates to MPI_Abort after
TLLM_MGMN_SHUTDOWN_GRACE_SECONDS (default 60); (2) the launcher's rank-0 subshell waits at most
TLLM_LLMAPI_LAUNCH_STOP_TIMEOUT seconds (default 120) for the MPI Comm server to exit after the stop
request, then kills it so the launcher exits with the task's code.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
Activity