mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3143] [P2P-Store] Same-region concurrent Add/Remove races in RegisteredMemory #809
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#809
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 @jfeng18 on GitHub (Jul 27, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/3143
Originally assigned to: @Icedcoco on GitHub.
Context
Follow-up from #2375 review discussion with @Icedcoco. Two same-region concurrency windows exist in
RegisteredMemory(mooncake-p2p-store/src/p2pstore/registered_memory.go) that predate #2375:Race 1: concurrent Add() during registration
Add()inserts thebufferListentry (refCount=1) and releases the lock before the underlyingregisterLocalMemorychunks complete. A concurrentAdd()for the same region hits the entry, increments refCount and returns success — but the memory may not be registered yet, and if the original registration fails, the rollback (added in #2375) removes the entry while the second caller still believes it holds a reference.Race 2: Add() overlapping a final Remove()
The last
Remove()deletes the entry and releases the lock before the underlyingunregisterLocalMemorycalls finish. A newAdd()for the same region can start registering while unregistration of the same addresses is still in flight.Open design question
Are same-region concurrent Add/Remove operations intended to be supported?
RegisteredMemorystating the contract (external serialization required for same-region calls) would make the current behavior well-defined.#2375 narrows the damage (no permanent stale entry on failed Add, no premature unregister on refCount>0) but intentionally does not change the visibility windows.
Happy to take this after #2375 lands, once maintainers weigh in on the intended contract.
@github-actions[bot] commented on GitHub (Jul 27, 2026):
Thanks for opening this issue, @jfeng18!
288662032A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@jfeng18 commented on GitHub (Jul 28, 2026):
Now that #2375 has landed — @ykwd could you weigh in on the design question here? If same-region concurrent Add/Remove should be supported, I'll implement per-entry state tracking; if it's outside the supported usage, a doc comment stating the contract would suffice. Happy to send the PR either way.
@github-actions[bot] commented on GitHub (Oct 27, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.