fix(pd): release partial request allocations on abort - #1479
Closed
sufubao wants to merge 1 commit into
Closed
Conversation
Follow up ModelTC#1476 by making pending PD cancellation exception-safe. If cancellation interrupts shared-memory request allocation before req_id_to_out_inf registration, return every acquired request object and slot index. Also make generation-task cancellation idempotent, drop obsolete delayed retries, clean pending events, and preserve CancelledError state.
Collaborator
Author
|
Closing after rechecking the actual PD request path. Since #1439, PD master expands multi-choice requests before dispatch and sends each P/D request with n=1 and best_of=1. Therefore the partial n>1 slot-allocation scenario in this PR is not reachable from the PD abort path, and upstream #1476 is sufficient for the reported pending-abort issue. The generic allocator cleanup may still be worth evaluating separately with a real non-PD cancellation reproducer. |
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.
Summary
Problem
#1476 correctly tracks and cancels generation tasks before they enter
req_id_to_out_inf. However, cancellation can arrive after one or more shared-memory request indexes have been allocated while the request is still waiting for another index. The allocation then unwinds without a registeredReqStatus, so neitherHttpServerManager.abort()nor the normal recycle loop can release those indexes. Repeated cancellations can permanently exhaust the finite request-slot pool.Verification
PYTHONPATH=$PWD python -m pytest -q unit_tests/server/httpserver(4 passed)git diff --check upstream/main...HEAD