[PD] Un-blacklist mooncake sessions when probe succeeds#25287
Merged
ShangmingCai merged 3 commits intoMay 20, 2026
Conversation
MooncakeKVManager adds a mooncake_session_id to self.failed_sessions the first time any KV transfer to that peer fails (one strike, no retry). The session is only removed when the decode side re-registers its KV args via the bootstrap thread. If a transient failure (network blip, peer GC pause, peer briefly unhealthy) blacklists the session but the decode side never re-registers, every subsequent prefill->decode request routed through that session fails forever with 'Decode instance could be dead' until one side restarts. Add a daemon thread on the prefill side that periodically issues a lightweight session probe (engine.send_probe) against every blacklisted session. If the probe succeeds, the session is removed from failed_sessions and session_failures, the event is logged, and sglang:failed_session_recoveries_total is incremented. Configuration: SGLANG_FAILED_SESSION_PROBE_INTERVAL_S (default 30s) The probe loop runs only in PREFILL mode (failed_sessions is prefill-only). Probe exceptions are swallowed with a warning so a single bad peer cannot kill the probe thread. Requires engine.send_probe on the mooncake-transfer-engine wheel, which is added in kvcache-ai/Mooncake#2088 and must be released (and the bundled MOONCAKE_VERSION bumped) before this change takes effect. Without that, the probe call raises AttributeError which is caught and logged; blacklist behavior is unchanged from today.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
21 tasks
ShangmingCai
approved these changes
May 15, 2026
Collaborator
ShangmingCai
left a comment
There was a problem hiding this comment.
Overall, I think this PR has a point, and well-implemented.
But we might need to wait for a new release of mooncake. Also, should we add an env var switch for this feature since we might only need this for specific usage, and other use-cases should not pay (another background thread and cpu overhead) for what they don't need?
Collaborator
|
/tag-and-rerun-ci |
ShangmingCai
approved these changes
May 20, 2026
Shunkangz
pushed a commit
to Shunkangz/sglang
that referenced
this pull request
May 27, 2026
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.

MooncakeKVManager adds a mooncake_session_id to self.failed_sessions the first time any KV transfer to that peer fails (one strike, no retry). The session is only removed when the decode side re-registers its KV args via the bootstrap thread. If a transient failure (network blip, peer GC pause, peer briefly unhealthy) blacklists the session but the decode side never re-registers, every subsequent prefill->decode request routed through that session fails forever with 'Decode instance could be dead' until one side restarts.
Add a daemon thread on the prefill side that periodically issues a lightweight session probe (engine.send_probe) against every blacklisted session. If the probe succeeds, the session is removed from failed_sessions and session_failures, the event is logged, and sglang:failed_session_recoveries_total is incremented.
Configuration:
SGLANG_FAILED_SESSION_PROBE_INTERVAL_S (default 30s)
The probe loop runs only in PREFILL mode (failed_sessions is prefill-only). Probe exceptions are swallowed with a warning so a single bad peer cannot kill the probe thread.
Requires engine.send_probe on the mooncake-transfer-engine wheel, which is added in kvcache-ai/Mooncake#2088 and must be released (and the bundled MOONCAKE_VERSION bumped) before this change takes effect. Without that, the probe call raises AttributeError which is caught and logged; blacklist behavior is unchanged from today.
Motivation
Modifications
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #25943738343⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.