mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3401] [Bug]: Replication tasks retain targets and reserved quota after source cleanup #870
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#870
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/3401
Bug Report
While reviewing #2877, I found a pre-existing replication-task lifecycle gap. This is not caused by making segment cleanup asynchronous, but async cleanup makes the retained state easier to observe.
When an in-flight Copy/Move source becomes unavailable,
CleanupStaleHandles()removes the invalid COMPLETE source replica. It only cancels promotion tasks for removed replica IDs, so a replication task whosesource_idwas removed is left behind together with its PROCESSING target replicas and reserved tenant quota. Those resources remain until the client callsCopyEnd/MoveEnd/CopyRevoke/MoveRevokeorDiscardExpiredProcessingReplicas()reaches the task timeout.Reproduction
A deterministic unit test can use the existing
MasterServiceTestfixture:MasterServicewith a tenant quota large enough for exactly the source and one temporary target.source_segmentandtarget_segment.PutStart+PutEnda key onsource_segment.CopyStart(client, key, ..., "source_segment", {"target_segment"}), orMoveStart(client, key, ..., "source_segment", "target_segment").source_segmentand wait until invalid-handle cleanup has removed the source replica.TenantState, or attempt another allocation under the strict quota.Observed state after step 5:
tenant_state.replication_tasksstill contains the key;reserved_quota_charge_bytesis still held;A compact assertion sketch:
Expected behavior
Removing a replica that is the source of a Copy/Move task should invalidate that task promptly, discard its PROCESSING targets, release its reserved quota, and balance the source reference if it still exists.
Relevant code
MasterService::CleanupStaleHandles()MasterService::CancelPromotionTaskForRemovedReplicas()MasterService::DiscardExpiredProcessingReplicas()This should be handled separately from #2877 so that the asynchronous-unmount PR can remain focused on RPC latency and immediate logical invisibility.
@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