Skip to content

[PD Disagg] Add bootstrapping timeout for nixl connector - #17845

Closed
rexrock wants to merge 1 commit into
sgl-project:mainfrom
rexrock:fix/nixl_bootstrapping_timeout
Closed

rexrock wants to merge 1 commit into
sgl-project:mainfrom
rexrock:fix/nixl_bootstrapping_timeout

Conversation

@rexrock

@rexrock rexrock commented Jan 28, 2026

Copy link
Copy Markdown

Motivation

In the PD separation mode, the nixl connector lacks a timeout mechanism during the bootstrapping phase. This can lead to the requests on the prefill side not being released when issues arise with the decode node or ZMQ communication.

Modifications

Following the implementation of Mooncake, this PR adds a timeout mechanism to the bootstrapping phase of the nixl connector. The timeout duration is configured via SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT, with a default value of 300s.

Accuracy Tests

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • /tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@ShangmingCai ShangmingCai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nixl seems to have a notify mechanism and use notif_map = self.agent.get_new_notifs() to recv notif, so these timeout params might not be needed for nixl backend since it can notify and abort the requests when an error happens.

But I am not quite sure, maybe this PR should be reviewed by @ishandhanani

@rexrock

rexrock commented Jan 28, 2026

Copy link
Copy Markdown
Author

nixl seems to have a notify mechanism and use notif_map = self.agent.get_new_notifs() to recv notif, so these timeout params might not be needed for nixl backend since it can notify and abort the requests when an error happens.

But I am not quite sure, maybe this PR should be reviewed by @ishandhanani

When nixl is used as the transport backend, the kv_indices are still transmitted via zmq, so the prefill side still requires a timeout mechanism to terminate potential infinite waits for kv_indices. The notify mechanism of nixl occurs during the send_aux and send_kvcache stages, which take place after the kv_indices received.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a timeout mechanism to the bootstrapping phase of the nixl connector in PD disaggregation mode to prevent indefinite waiting when decode nodes or ZMQ communication fail.

Changes:

  • Added configurable bootstrap timeout via SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT environment variable (default: 300s)
  • Implemented timeout tracking and handling in the KVTransferHandle.poll() method to abort timed-out requests
  • Added initialization timestamp tracking for timeout calculation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +773 to +777
logger.warning_once(
"Some requests timed out when bootstrapping, "
"which means prefill instances fail to receive the KV indices from the decode instance of this request. "
"If a greater mean TTFT is acceptable, you can 'export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600' (10 minutes) to relax the timeout condition. "
)

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses logger.warning_once() which may not be appropriate for timeout events that could occur for multiple different requests. Consider using logger.warning() instead, or include the request identifier in the message to ensure each unique timeout is logged.

Copilot uses AI. Check for mistakes.
Comment on lines +769 to +783
if self.init_time is not None:
now = time.time()
elapsed = now - self.init_time
if elapsed >= self.kv_mgr.bootstrap_timeout:
logger.warning_once(
"Some requests timed out when bootstrapping, "
"which means prefill instances fail to receive the KV indices from the decode instance of this request. "
"If a greater mean TTFT is acceptable, you can 'export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600' (10 minutes) to relax the timeout condition. "
)
self.kv_mgr.record_failure(
self.bootstrap_room,
f"Request {self.bootstrap_room} timed out after {elapsed:.1f}s in KVPoll.Bootstrapping",
)
self.conclude_state = KVPoll.Failed
return KVPoll.Failed

Copilot AI Jan 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check if self.init_time is not None is unnecessary since init_time is always initialized to time.time() in __init__ at line 740 and is never set to None. This redundant check adds confusion about when init_time might be None.

Suggested change
if self.init_time is not None:
now = time.time()
elapsed = now - self.init_time
if elapsed >= self.kv_mgr.bootstrap_timeout:
logger.warning_once(
"Some requests timed out when bootstrapping, "
"which means prefill instances fail to receive the KV indices from the decode instance of this request. "
"If a greater mean TTFT is acceptable, you can 'export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600' (10 minutes) to relax the timeout condition. "
)
self.kv_mgr.record_failure(
self.bootstrap_room,
f"Request {self.bootstrap_room} timed out after {elapsed:.1f}s in KVPoll.Bootstrapping",
)
self.conclude_state = KVPoll.Failed
return KVPoll.Failed
now = time.time()
elapsed = now - self.init_time
if elapsed >= self.kv_mgr.bootstrap_timeout:
logger.warning_once(
"Some requests timed out when bootstrapping, "
"which means prefill instances fail to receive the KV indices from the decode instance of this request. "
"If a greater mean TTFT is acceptable, you can 'export SGLANG_DISAGGREGATION_BOOTSTRAP_TIMEOUT=600' (10 minutes) to relax the timeout condition. "
)
self.kv_mgr.record_failure(
self.bootstrap_room,
f"Request {self.bootstrap_room} timed out after {elapsed:.1f}s in KVPoll.Bootstrapping",
)
self.conclude_state = KVPoll.Failed
return KVPoll.Failed

Copilot uses AI. Check for mistakes.
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @rexrock. Closing this because it has had no updates in 199 days.

Reopen it if the work is still relevant.

Some directories moved recently, so an older branch may need retargeting:
sgl-kernel/ -> python/sglang/kernels/aot/, python/sglang/jit_kernel/
-> python/sglang/kernels/jit/, docs/ -> docs/docs/ (.mdx),
bench_serving.py -> benchmark/serving.py, test/srt/ -> test/registered/.

@github-actions github-actions Bot closed this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants