Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vllm/v1/core/sched/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,5 +1287,7 @@ def _update_from_kv_xfer_finished(self,
logger.debug("Finished recving KV transfer for request %s", req_id)
self.finished_recving_kv_req_ids.add(req_id)
for req_id in (kv_connector_output.finished_sending or ()):
if req_id not in self.requests:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could also add the existence check for for req_id in (kv_connector_output.finished_recving or ()):

continue
logger.debug("Finished sending KV transfer for request %s", req_id)
self._free_blocks(self.requests[req_id])
Comment on lines +1290 to 1293
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The added check correctly prevents the KeyError if a request has been aborted and removed from self.requests. For a slight improvement in efficiency and conciseness, you could use dict.get() to perform the check and retrieval in a single operation. This avoids the double dictionary lookup (in followed by []).

Suggested change
if req_id not in self.requests:
continue
logger.debug("Finished sending KV transfer for request %s", req_id)
self._free_blocks(self.requests[req_id])
request = self.requests.get(req_id)
if request:
logger.debug("Finished sending KV transfer for request %s", req_id)
self._free_blocks(request)