You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add URMA runtime recovery and TCP fallback - #3708
URMA can fall back to TCP during connection setup, but established failures do not guide subsequent connection attempts. A failed server SEND can close the control socket while the client immediately reconnects over URMA to the same peer.
What is changed and the side effects?
Add process-level LEGACY, AUTO and TCP_ONLY modes. AUTO applies a configurable peer cooldown, defaulting to 5 seconds; LEGACY remains the default. New connections use TCP during cooldown and can select URMA afterward.
Report completion, JFC and WR-posting failures once per connection. Ignore reports from earlier policy epochs, count access errors separately and preserve EAGAIN for backpressure.
Report established client control-socket EOF/read failures so server-side faults also trigger peer cooldown. Normal server-side EOF from short clients closes the connection without cooling down the peer.
Select CTP/RTP paths from device capabilities, release short-connection resources, serialize TCP reads and initialize/validate send SGEs. Optional aligned copied sends add one payload copy.
Add a recovery client, process-local SEND fault injection, independent regression tests, documentation and a URMA mock CI workflow.
Publish mock SEND completions after payload delivery so polling consumers can release source buffers safely. Run the completion-order regression in URMA mock CI.
Mode changes affect new connections. Short connections can resume URMA after cooldown; established single/pooled TCP connections can continue serving RPCs. Existing v2/v3 wire formats remain compatible.
Validation
The local URMA mock suite passed all 16 regression groups with RDMA disabled, including the SEND completion-order test.
The server-SEND regression reproduces the missing client cooldown before the fix. All 8 CTP/RTP, v2/v3 and event/polling combinations pass after it, covering normal short closes, TCP cooldown, URMA recovery and 64 KiB attachment validation.
Prior URMA RM/RTP hardware runs passed TCP_ONLY, v2/v3 AUTO, runtime mode switching and single/pooled 64 KiB/1 MiB attachment checks. Client SEND-post injection passed event short/single/pooled and polling short runs with 1 MiB attachments: one expected RPC failure per run, subsequent RPC recovery and zero content-validation failures. Short connections resumed URMA after TCP cooldown.
Related discussions and PRs
Discussion #3711: runtime recovery and business QoS configuration.
On the RDMA question: URMA-only is fine for this PR. RDMA has no equivalent runtime recovery today -- it only falls back to TCP while the handshake/queue-pair bring-up is failing (rdma_endpoint.cpp), and an established QP error is treated as unrecoverable. So there is no parity gap this PR has to close. If the mechanism proves useful, the generalization worth doing afterwards is a transport-agnostic "a transport failure cools this peer for the next N seconds / new connections degrade to TCP" hook shared by RDMA and URMA, rather than a second process-global copy of the policy inside RDMA. That is also an argument for keeping the policy interface small and transport-neutral where it is cheap to do so.
On the RDMA question: URMA-only is fine for this PR. RDMA has no equivalent runtime recovery today -- it only falls back to TCP while the handshake/queue-pair bring-up is failing (rdma_endpoint.cpp), and an established QP error is treated as unrecoverable. So there is no parity gap this PR has to close. If the mechanism proves useful, the generalization worth doing afterwards is a transport-agnostic "a transport failure cools this peer for the next N seconds / new connections degrade to TCP" hook shared by RDMA and URMA, rather than a second process-global copy of the policy inside RDMA. That is also an argument for keeping the policy interface small and transport-neutral where it is cheap to do so.
fully agree with this viewpoint. First, we plan to first establish and improve the fallback capability through the URMA memory semantics, and then use this as a foundation to extend it to the upper layers of the entire architecture. We will attempt to expand the functionality of RDMA, UBShm, and other transport layers, such as the design of a common fallback hook function. We will first internally align and provide the relevant plan. @wwbmmm
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical teardown and EAGAIN paths can report successful sends without peer delivery or lose retryable payloads, so the active issues must be fixed before approval.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical issues remain: the ack-flush scheduling race can permanently suppress retries and the recovery test does not compile in supported build configurations due to missing and conditionally excluded headers.
URMA-disabled builds fail due to missing test and gflags headers
test/brpc_urma_recovery_unittest.cpp:24
This new test is not buildable: main() always calls gflags::ParseCommandLineFlags, but this file does not include <gflags/gflags.h>. Also, the gtest include is inside #if BRPC_WITH_URMA, while CMake/Make still discover and compile this test when URMA is disabled, leaving testing::InitGoogleTest undeclared in the default build. Move the test-framework includes outside the feature guard and add the missing gflags header.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
URMA can fall back to TCP during connection setup, but established failures do not guide subsequent connection attempts. A failed server SEND can close the control socket while the client immediately reconnects over URMA to the same peer.
What is changed and the side effects?
Mode changes affect new connections. Short connections can resume URMA after cooldown; established single/pooled TCP connections can continue serving RPCs. Existing v2/v3 wire formats remain compatible.
Validation
Related discussions and PRs
Check List