Skip to content

Commit f1850f5

Browse files
kevincheng2claude
andcommitted
[KVCache][BugFix] fix increment ref count logic in cache_manager
## Motivation `increment_ref_nodes` should only be called during the scheduling phase (when `skip_storage=True`), not during the actual storage prefetch phase. The previous condition was inverted, causing ref counts to be incremented at the wrong time. ## Modifications - Fix condition from `not (self._storage_scheduler and skip_storage)` to `skip_storage` in `CacheManager.match` - Update comment to clarify "only scheduling phase" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 01b8eb5 commit f1850f5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fastdeploy/cache_manager/v1/cache_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ def match_prefix(
532532
storage_matches = self._match_storage(remaining_hashes)
533533
result.storage_nodes = self.prepare_prefetch_metadata(storage_matches)
534534

535-
# Step 3: Increment ref count for matched blocks(only first match node)
536-
if not (self._storage_scheduler and skip_storage):
535+
# Step 3: Increment ref count for matched blocks(only scheduling phase)
536+
if skip_storage:
537537
self._radix_tree.increment_ref_nodes(matched_nodes)
538538

539539
logger.info(

0 commit comments

Comments
 (0)