Skip to content

bugfix: defer stream cancellation to scheduler boundary.#1926

Merged
phantomlei3 merged 1 commit into
xLLM-AI:mainfrom
phantomlei3:bugfix/pd-request-cancel
Jul 13, 2026
Merged

bugfix: defer stream cancellation to scheduler boundary.#1926
phantomlei3 merged 1 commit into
xLLM-AI:mainfrom
phantomlei3:bugfix/pd-request-cancel

Conversation

@phantomlei3

@phantomlei3 phantomlei3 commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

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

  • Bug fix
  • New feature
  • Performance improvement
  • Refactor
  • Documentation
  • Test
  • Build or CI

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

  • The PR title and each commit message follow the xLLM commit format: <type>: <subject>.

Allowed types: feat, bugfix, docs, test, refactor, chore, style, revert, perf, model, build, release.
The subject should use clear English, start with a verb, include at least 4 words, and end with ..

Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit or an equivalent command.
  • I have installed the hooks with pre-commit install.
  • I have run pre-commit run --all-files and fixed any reported issues.

If you are unsure how to set up pre-commit, see the pre-commit documentation.

Self Review

  • I have self-reviewed the code according to .agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.
  • I have rebased this PR onto the latest main branch.

Build and Test Coverage

  • Tests have been added or updated as needed.
  • CUDA: python setup.py build test has passed on a CUDA machine.
  • NPU: python setup.py build test has passed on an NPU machine.
  • MLU: python setup.py build test has passed on an MLU machine.

Reviewer Notes

- queue rejected stream requests for scheduler-owned cancellation
- preserve async response processor lifetime during shutdown
- cover single, batch, duplicate, and late cancellation paths
@phantomlei3
phantomlei3 force-pushed the bugfix/pd-request-cancel branch from eb11380 to 9af5c59 Compare July 13, 2026 02:45
@phantomlei3
phantomlei3 merged commit 2c2161f into xLLM-AI:main Jul 13, 2026
5 of 16 checks passed
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