Fix RDMA PollCq missing recv CQEs after re-arming the CQs - #3425
Open
chenBright wants to merge 1 commit into
Open
Fix RDMA PollCq missing recv CQEs after re-arming the CQs#3425chenBright wants to merge 1 commit into
chenBright wants to merge 1 commit into
Conversation
PollCq only re-polled send_cq after arming both CQs, so a recv CQE arriving in the one-shot notification race window of recv_cq was left in the CQ and the RPC timed out. Restart the re-poll from recv_cq so that both CQs are covered.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a race in RdmaEndpoint::PollCq() where a recv CQE could be stranded after re-arming CQs due to ibv_req_notify_cq() one-shot semantics, leading to stalled connections and RPC timeouts (issue #3415).
Changes:
- After re-arming both
send_cqandrecv_cq, explicitly switches the polling state back torecv_cq. - Ensures the intended poll → arm → re-poll pattern is applied to both CQs, preventing missed recv CQEs in the poll/notify race window.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
LGTM |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Issue Number: resolve #3415
Problem Summary:
The completion notification requested by
ibv_req_notify_cq()is one-shot: a CQEthat is already in the CQ when the CQ is armed does NOT generate a new completion
channel event. The standard pattern is therefore poll -> arm -> re-poll.
RdmaEndpoint::PollCq()pollsrecv_cqfirst and switches tosend_cqoncerecv_cqis empty. When both CQs are empty it arms them viaReqNotifyCq(true)/ReqNotifyCq(false), but it keepssend = trueandcq = send_cqafterwards, so onlysend_cqis re-polled.recv_cqis neverre-polled although the comment right above claims it is.
As a result, if a solicited recv CQE arrives in the race window between
"poll
recv_cqreturns empty" and "armrecv_cq", the CQE is stranded inrecv_cq: no new event is delivered and no re-poll picks it up. The receivedmessage is never handed to
ProcessNewMessage(), and the connection stalls untilan unrelated CQE happens to arrive, which shows up as RPC timeouts.
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: