mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3402] [Bug]: MoveEnd leaks source replica refcount when the target disappears #869
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#869
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 @Aionw on GitHub (Aug 12, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/3402
Bug Report
While reviewing #2877, I found a pre-existing reference-count leak in the Move error path.
MoveStart()increments the COMPLETE source replica's refcount to protect it from eviction. If the target segment is unmounted beforeMoveEnd(), the target is removed as an invalid handle.MoveEnd()then enters its missing/invalid-target branch, aborts the reserved quota, and erases the replication task, but it does not decrement the source refcount.Because the task has already been erased, neither
MoveRevoke()nor the task timeout can release that reference later. The surviving source remains permanently busy and cannot be overwritten or evicted.Reproduction
source_segmentandtarget_segment.PutStart+PutEnda key onsource_segment.MoveStart(client, key, ..., "source_segment", "target_segment").target_segmentbefore callingMoveEnd().MoveEnd(); it returnsREPLICA_IS_GONE.UpsertStart()for the surviving key.MoveRevoke().Expected externally visible results for a regression test:
The same condition can be asserted directly in
MasterServiceTest: the source refcount is 1 after the failedMoveEnd()even though no replication task remains.Expected behavior
The invalid-target error path should balance the reference acquired by
MoveStart()before erasing the task. The surviving source should remain readable and become eligible for upsert/eviction normally.Relevant code
In
MasterService::MoveEnd(), the invalid-target branch currently calls:It needs to release the source reference (and keep target cleanup/accounting balanced) before the task becomes unreachable.
This issue predates #2877 and should be fixed independently from the asynchronous-unmount change.
@github-actions[bot] commented on GitHub (Aug 12, 2026):
Thanks for opening this issue, @Aionw!
41376987A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide