mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2980] [Bug]: File-per-key path mapping can collide and return another object's data #769
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#769
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 @feichai0017 on GitHub (Jul 17, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2980
Bug Report
On current
main(f20b7061),ResolvePathFromKey()is not collision-safe for file-per-key storage.The path uses only the low 8 bits of
std::hash<std::string>for its two directory levels, whileSanitizeKey()maps each of/\\:*?"<>|to_. For a fixed tenant, the 10,000 four-character keys built from those characters plus_all sanitize to the same filename but have only 256 possible directory pairs, so at least two distinct keys must map to the same path.This is a correctness problem because:
O_TRUNC, so the later key overwrites the earlier file;StorageBackendAdaptor::BatchLoad()deserializes the storedKVEntrywithout checking that its key matches the requested key;The same path helper is used by file-per-key LOCAL_DISK storage and the legacy DISK replica path.
Expected behavior
Distinct object identities must never resolve to the same on-disk object path in normal operation, and reads must reject records whose stored key does not match the requested key.
Proposed direction
Use a stable full-key digest for the filename, retain a legacy-path read fallback for existing files, and validate the deserialized key before copying data to the caller.
Before submitting...
@github-actions[bot] commented on GitHub (Jul 17, 2026):
Thanks for opening this issue, @feichai0017!
132118805A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide