Skip to content

vLLM prefix cache blocks keep stale block_hash after eviction #362

Description

@shipiyouniao

Summary

When kvcached's vLLM prefix-cache block pool evicts or explicitly frees cached blocks, it removes the block from kvcached's own cache indexes and returns the block id to the kvcached allocator. However, the vLLM KVCacheBlock object can keep its cached block_hash value.

Problem

A returned block object may later be reused for a different prefix. If its old block_hash is still present, vLLM block state and kvcached's prefix-cache indexes can diverge. In vLLM versions where block_hash is write-once until reset_hash() is called, recaching the reused block can also fail or keep stale state.

Expected behavior

Whenever kvcached returns a cached or uncached block to the allocator through eviction, explicit eviction, immediate uncached free, or prefix-cache reset, the associated vLLM block hash state should be cleared before the block can be reused.

Impact

This is a prefix-cache correctness issue. It is most visible when the same KVCacheBlock object is evicted and later reallocated for a different prefix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions