Problem
PegaEngine::rdma_accept_handshake (pegaflow-core/src/lib.rs) does:
invalidate_connection(client_addr) — tear down any stale connection
get_or_prepare(client_addr) — expects Prepared, treats Existing as unreachable!("just invalidated connection")
Steps 1 and 2 take the backend lock separately. If two nodes handshake with each other simultaneously (exactly the deployment shape of the transfer-lock incident: peers booting together and cross-fetching), the local node's outbound complete_handshake_for can insert addr_connections[client_addr] in the window between the two calls. get_or_prepare then returns Existing and the unreachable! panics the gRPC handler.
Impact
Panic in the accept path; the peer's handshake fails and retries. Low probability per attempt but structurally reachable, and mutual-handshake bursts are the norm after a rolling restart.
Suggested fix
Replace the unreachable! with an error return (peer retries and then reuses the fresh connection), or make invalidate+prepare atomic under one lock.
Context
Flagged during the #399 review (pre-existing).
🤖 Generated with Claude Code
Problem
PegaEngine::rdma_accept_handshake(pegaflow-core/src/lib.rs) does:invalidate_connection(client_addr)— tear down any stale connectionget_or_prepare(client_addr)— expectsPrepared, treatsExistingasunreachable!("just invalidated connection")Steps 1 and 2 take the backend lock separately. If two nodes handshake with each other simultaneously (exactly the deployment shape of the transfer-lock incident: peers booting together and cross-fetching), the local node's outbound
complete_handshake_forcan insertaddr_connections[client_addr]in the window between the two calls.get_or_preparethen returnsExistingand theunreachable!panics the gRPC handler.Impact
Panic in the accept path; the peer's handshake fails and retries. Low probability per attempt but structurally reachable, and mutual-handshake bursts are the norm after a rolling restart.
Suggested fix
Replace the
unreachable!with an error return (peer retries and then reuses the fresh connection), or make invalidate+prepare atomic under one lock.Context
Flagged during the #399 review (pre-existing).
🤖 Generated with Claude Code