[KVConnector] Guard lmcache_mp_connector state transition with num_external_tokens (#47505)
Signed-off-by: Alex <alex.tech.lab@outlook.com> Signed-off-by: Alex-ai-future <Alex-ai-future@users.noreply.github.com>
AlexHuang committed
Sep 7, 2026 at 16:19 UTC
49eb2accf0610d220f451f2f3c1dfe93fe395c79
1 file changed
+6
-2
vllm/distributed/kv_transfer/kv_connector/v1/lmcache_mp_connector.py
+6
-2
@@ -835,8 +835,12 @@ class LMCacheMPConnectorUpstream(KVConnectorBase_V1):
835
if new_block_ids:
836
tracker.append_block_ids(new_block_ids)
837
838
- # Update the state of the tracker
839
- condition = tracker.needs_retrieve()
838
+ # num_external_tokens > 0 means this connector is chosen for loading.
839
+ # When non-chosen (num_external_tokens == 0, e.g. in MultiConnector),
840
+ # force condition=False so the state goes to READY and all lookup locks
841
+ # are released — end_session does NOT release lookup locks, so without
842
+ # this they would leak until TTL expiry (10 minutes).
843
+ condition = tracker.needs_retrieve() and num_external_tokens > 0
844
if tracker.state == LMCacheMPRequestState.PREFETCHING:
845
# If need to retrieve, change to WAITING_FOR_LOAD
846
# Otherwise, change to READY