bugfix: defer stream cancellation to scheduler boundary.#1926
Merged
Conversation
phantomlei3
requested review from
Clement-Wang26,
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
RobbieLeung,
XuZhang99,
liujinguang0125,
liutongxuan,
walsonyang,
xiao-yu-chen,
yingxudeng,
yq33victor and
zhang-minchao
as code owners
July 11, 2026 09:15
weizhehuang0827
approved these changes
Jul 13, 2026
- queue rejected stream requests for scheduler-owned cancellation - preserve async response processor lifetime during shutdown - cover single, batch, duplicate, and late cancellation paths
phantomlei3
force-pushed
the
bugfix/pd-request-cancel
branch
from
July 13, 2026 02:45
eb11380 to
9af5c59
Compare
DongheJin
approved these changes
Jul 13, 2026
17 tasks
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
Issue: In PD-disaggregated serving, a failed Decode streaming response could cancel a request
asynchronously between the scheduler’s terminal-state scan and running-queue rebuild, violating
scheduler invariants and triggering a fatal error that terminated the Decode process.
Fix: Defer streaming cancellations through a thread-safe queue and apply them at the next scheduler
boundary, ensuring safe state transitions and KV Cache release. The fix supports single, batched,
duplicate, and late cancellations, with corresponding unit-test coverage.
Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes