Repository navigation
[None][fix] Disagg: keep the KV handshake id on generation retries; do not let one wedged receive park a rank - #19802
Merged
zongfeijing merged 1 commit intoOct 2, 2026
Conversation
…o not let one wedged receive park a rank Two production runs (2P4+1D16, attention-DP generation engine) each lost ~10 minutes of training to the same chain: 1. The frontend's generation leg hit a transient "Server disconnected" and was retried. OpenAIHttpClient._post_with_retry regenerated disagg_request_id on every retry, for both legs. For a generation leg that id is the KV handshake the context worker registered its send session under when prefill finished, so the retried request asked the context side for KV under an id nobody held: the sender parked the REQUEST_DATA for a session that never came, the generation request sat in DISAGG_GENERATION_TRANS_IN_PROGRESS, and both sides waited out kv_transfer_timeout_ms (600 s). Regenerate the id only for context_only retries, which re-run prefill and need a fresh one. 2. The stuck receive kept its blocks in DisaggTransferAdmissionController's budget (max_tokens_in_buffer, by default max_seq_len). Admission is FCFS, so the first gen-init candidate on that rank that no longer fit next to it stopped admission for every candidate behind it, however small, until the timeout cancelled the head: 30-35 requests queued 300-600 s and were released in one iteration. A receive in flight longer than TRTLLM_DISAGG_ADMISSION_STALE_TRANSFER_S (default 10 s, 0 disables) now stops counting toward the window; it still ends through kv_transfer_timeout_ms, and the first exclusion is logged once. 3. Two safety nets for a duplicate attempt that does reach both sides: a second generation request for a handshake that already has a live receive is failed through the transfer-error path instead of being left in DISAGG_GENERATION_INIT, where it would be re-admitted every iteration with no transfer to time out; and the context sender answers a REQUEST_DATA naming a send session that already ended with FAILED instead of parking it (retired ids are remembered for 120 s, bounded), so the requester fails fast. Unknown ids are still parked for the gen-first flows that ask before the session exists. Signed-off-by: Zongfei Jing <[email protected]>
zongfeijing
force-pushed
the
user/zongfeij/disagg-gen-retry-handshake-fix
branch
from
October 2, 2026 07:56
c81308c to
8c3bd3c
Compare
jepio
added a commit
to NVIDIA-NeMo/RL
that referenced
this pull request
Oct 2, 2026
Signed-off-by: Jeremi Piotrowski <[email protected]>
shuyixiong
pushed a commit
to shuyixiong/TensorRT-LLM
that referenced
this pull request
Oct 6, 2026
…o not let one wedged receive park a rank (NVIDIA#19802) Signed-off-by: Zongfei Jing <[email protected]>
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.
Description
Two production disaggregated runs (2P4+1D16, attention-DP generation engine, Python/NIXL transceiver) each lost about ten minutes of training to the same chain, visible in the Gym timeline as 30-35 generation requests on one rank waiting 300-600 s in the "generation queue" and all being scheduled in the same iteration.
Server disconnectedand was retried.OpenAIHttpClient._post_with_retryregenerateddisagg_request_idon every retry, for both legs. For a generation leg that id is the KV handshake the context worker registered its send session under when prefill finished, so the retried request asked for KV under an id nobody held: the sender parked theREQUEST_DATAfor a session that never came (_respond_with_kv->_save_peer_req_info, the gen-first path), the generation request sat inDISAGG_GENERATION_TRANS_IN_PROGRESS, and both sides waited outkv_transfer_timeout_ms(600 s):Observed timeout on context request ... elapsed 601353ms,Observed timeout on generation request ... elapsed 600006ms, HTTP 500Request timed out (KV transfer).DisaggTransferAdmissionController's budget (max_tokens_in_buffer, by defaultmax_seq_len). Admission is FCFS, so the first gen-init candidate on that rank that no longer fit next to it stopped admission for every candidate behind it, however small, until the timeout cancelled the head. In both runs the first parked request is exactly the first candidate larger than the remaining budget (22896 + 44297 and 31435 + 35588 prompt tokens against a 65536-token window).Changes:
serve/openai_client.py: regeneratedisagg_request_idonly forcontext_onlyretries (they re-run prefill and need a fresh id); a generation retry keeps the handshake id._torch/disaggregation/orchestration/admission.py: a generation receive in flight for longer thanTRTLLM_DISAGG_ADMISSION_STALE_TRANSFER_S(default 30 s, 0 disables) stops counting toward the transfer window and is reported separately; the first exclusion is logged once with the receive's age. It still ends throughkv_transfer_timeout_ms. 30 s sits above the slowest healthy receives seen (first contact between a context and a generation rank at cold start, 10-20 s without a warm-up phase) and far below the timeout._torch/disaggregation/transceiver.py: a second generation request for a handshake that already has a live receive is failed through the transfer-error path instead of being left inDISAGG_GENERATION_INIT, where it would be re-admitted every iteration with no transfer to time out. Re-submitting the request that owns the receive stays a no-op._torch/disaggregation/native/transfer.py: the context sender remembers retired send-session ids for 120 s (bounded) and answers aREQUEST_DATAnaming one of them withFAILEDinstead of parking it, so the requester fails fast. Ids it has never seen are still parked for the gen-first flows that ask before the session exists.Test Coverage
Run in the production image with these four modules overlaid:
tests/unittest/_torch/disaggregation/test_disagg_coordinator_admission.py,tests/unittest/disaggregated/test_disagg_openai_client.py,tests/unittest/disaggregated/test_transfer_ownership_regressions.py,tests/unittest/disaggregated/test_transceiver_bounded_polling.py,tests/unittest/disaggregated/test_openai_disagg_service.py, and the disagg/admission/transfer subset oftests/unittest/_torch/executor/test_py_executor.py: all passing.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.