mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2960] [RFC]: Enhanced RDMA RNIC Failover and Recovery #764
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#764
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 @alogfans on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2960
Changes proposed
Background
Mooncake Transfer Engine supports selecting local and remote RNICs in multi-RDMA-NIC environments through topology and NIC priority matrices. In production, however, a single RNIC may experience link down events, port errors, GID changes, QP errors, or other transient failures.
The current implementation already includes partial recovery mechanisms, such as endpoint reconstruction, GID reprobe, ready ACK, and metadata refresh. However, real RNIC down/up testing still exposed several gaps:
PORT_ERRtoPORT_ACTIVE, immediately publishing it as available may be too early. In real RoCE/mlx5 environments, the data path may still reject connections shortly after link-up.This RFC proposes improving RDMA RNIC failover recovery so that transfers can continue through fallback RNICs when a single RNIC fails, and recovered RNICs are safely republished.
Goals
IBV_EVENT_PORT_ACTIVE.Non-Goals
Design Overview
1. Local RNIC Handoff
When a local RDMA context is marked inactive, or when the worker pool detects a local completion failure, the current worker no longer fails the slice immediately. Instead, it tries to hand the slice off to another active local context.
During handoff, the following remote-side information is preserved:
target_idpeer_nic_pathdest_addrdest_rkeyOnly local send-side information is updated:
source_lkeyrdma.endpoint = nullptrThe slice is then re-enqueued into the fallback context's worker pool.
This avoids treating a local RNIC failure as a remote rail failure and reduces the need to re-resolve remote metadata.
2. Peer Rail Failure
For non-local completion failures or handshake failures, if an alternative peer rail is available, the current peer rail is paused and the slice is redispatched to another peer RNIC.
Peer rail pause state is managed with rail state tracking:
pause_until_nsonce the threshold is reached.For explicit handshake or ready ACK timeouts, the peer rail can be paused immediately.
3. Context Inactive State and Topology Publishing
When any of the following async events are received, the RDMA context is marked inactive:
IBV_EVENT_DEVICE_FATALIBV_EVENT_CQ_ERRIBV_EVENT_WQ_FATALIBV_EVENT_PORT_ERRIBV_EVENT_LID_CHANGEAfter the context becomes inactive, Transfer Engine refreshes the local topology, disables that RNIC in the topology, and republishes the local segment descriptor.
Once peers refresh metadata, they can avoid selecting the failed RNIC.
4. Delayed Recovery
Receiving
IBV_EVENT_PORT_ACTIVEdoes not necessarily mean the data path is immediately usable. In real RoCE/mlx5 environments, RTR/RTS transitions or path resolution may still fail for a short period after link-up.The recovery flow therefore does not immediately republish the RNIC as active. Instead:
PORT_ACTIVE.recovery_activate_after_ns.The default recovery delay is 30 seconds.
5. Endpoint and QP Lifecycle Improvements
For endpoints that have not yet completed connection setup, handshake failure no longer causes the old QPs to be reset and reused.
The reason is that when the active side sees a failure, the passive side may already have received and cached the old QP numbers. Reusing those QPs could make the next handshake ambiguous with the previous partially processed handshake.
The new behavior is:
ERRso outstanding WRs can be flushed.6. Passive Handshake Error Replies
When the passive handshake callback fails, the server still returns a structured handshake response and fills
reply_msg.This lets the active side observe a concrete rejection reason instead of seeing an empty response or decode failure.
Example errors include:
peer_nic_path.7. Submit-Path Fallback for Inactive Devices
The submit path may preselect a local device at request granularity. If that selected device later becomes inactive, the request-level selection must not be reused.
The new behavior is:
Validation
Unit and Integration Tests
The following scenarios were validated with
mlx5_1throughmlx5_4:PORT_ERR, while transfers continue for 20 seconds.PORT_ERR, while transfers continue for 20 seconds.Real Link Test
A real RDMA link failover validation script is added:
Default topology:
mlx5_2mlx5_1mlx5_3mlx5_4The script starts a target and an initiator, then runs:
Pass criteria:
Compatibility
ready_ack, GID reprobe, and metadata refresh behavior remains backward compatible.Risks
1. Local Failure Misclassification
Some WC statuses may be caused by either local or remote issues. The implementation only classifies clearly local WC statuses as local failures to avoid disabling a context too aggressively.
2. Slow Recovery
The 30-second recovery delay may cause a recovered RNIC to rejoin later than strictly necessary. This is intentionally conservative and prioritizes stability.
3. Metadata Refresh Delay
Whether peers quickly avoid an inactive RNIC depends on metadata refresh or remote segment descriptor reload timing.
4. Multi-Worker Concurrency
Handoff enqueues slices across worker pools, so slice lifecycle and completion counters must remain correct under concurrency.
Future Work
Before submitting a new issue...
@github-actions[bot] commented on GitHub (Jul 16, 2026):
Thanks for opening this issue, @alogfans!
6733552A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@github-actions[bot] commented on GitHub (Oct 15, 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.
@github-actions[bot] commented on GitHub (Oct 22, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.