mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4529] [Bug]: Expired Get/BatchGet reads can populate the local hot cache #1154
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jacklin78911-collab on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4529
Problem
With local hot caching enabled,
Client::Getand bothBatchGetpaths promote completed READ data before validating the query's read lease. They can returnLEASE_EXPIREDwhile leaving that rejected payload in the hot cache. A later read with a live lease and a same-size replica can return success using those cached bytes.Audited main:
dcddb56c0cddc96f41eeb8dd82e5bd9f497183a2.Mechanism
ProcessSlicesAsync, thenIsLeaseExpired.Reproduction and observed results
I added the test below to the existing
client_local_hot_cache_test.cppfixture. It uses the real Client/cache paths, registered memory, an in-process master, TCP for the preferred batch path, and SHM hot caching (8 KiB, 4 KiB blocks, admission threshold 1). Single Get and regular BatchGet use the local memcpy path.For each of single Get, regular BatchGet, and preferred same-node BatchGet:
Bbytes using an already-expiredQueryResult.LEASE_EXPIRED.Abytes and provide a fresh, liveQueryResult.Bbytes from the rejected read.All three modes exhibited both failures in the test: nonzero admission count and wrong payload on the subsequent read. There were no transfer failures in the final registered-buffer reproduction.
This deliberately controls the metadata and source buffer; it does not simulate a master-driven eviction or establish the frequency of this failure in production. It proves that an expired read can publish a cache entry and that entry is subsequently usable. Region reuse after lease expiry is the concerning production case.
Build note: current main needed the existing unrelated build prerequisite from #4513 (Environ API removal). I applied those changes only in the validation copy. Neither the Client read paths nor hot-cache implementation was modified.
Reproduction test (append inside the existing mooncake::testing namespace)
Expected behavior / minimal fix direction
Data from a read rejected for an expired lease must not be admitted or published into the local hot cache. Move promotion behind lease validation, preserving transfer/checksum errors and the existing final aggregate lease semantics for batch reads. This requires ordering the existing operations, not adding a new cache policy or transport mechanism.
#2471 protects detached fills against local invalidation; #4334 addresses block-key access races. Neither addresses admission before lease validation. The broader object-identity/region-reuse discussion in #4489 is related, but this issue isolates the Client cache side effect of a read that it already rejects.
AI assistance: Codex assisted source inspection and the reproduction. No production read/cache fix is included in this report.
@github-actions[bot] commented on GitHub (Oct 9, 2026):
Thanks for opening this issue, @jacklin78911-collab!
251732545A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide