chenBright opened a new pull request, #3424:
URL: https://github.com/apache/brpc/pull/3424

   ### What problem does this PR solve?
   
   Issue Number: resolve #3416
   
   Problem Summary:
   
   During the RDMA handshake, `RdmaEndpoint::AllocateResources()` arms the 
send/recv
   CQs through `ReqNotifyCq()`. If `ibv_req_notify_cq()` fails, `ReqNotifyCq()` 
calls
   `_socket->SetFailed()` immediately. However, both handshake paths
   (`ProcessHandshakeAtClient()` and `ExecuteServerHandshake()`) treat
   `AllocateResources() < 0` as a *recoverable* error: they only turn RDMA off
   (`RDMA_OFF`) and move the endpoint to `FALLBACK_TCP`, expecting the 
connection to
   keep working over plain TCP. Since the socket has already been failed, the
   connection cannot carry TCP any more, so a single CQ arm failure turns a
   "graceful degradation to TCP" into a "broken connection".
   
   While fixing this, a second issue was found on the same path. 
`RdmaConnect::Run()`
   reports the connect result with `_done(errno, _data)`, i.e. it uses the 
current
   `errno` as the connect error code. The client-side fallback branch returns 
right
   after `AllocateResources()` fails, leaving `errno` set to the allocation 
error,
   while every other path in `ProcessHandshakeAtClient()` ends with `errno = 
0`. As a
   result the connection is reported as failed to the upper layer even after the
   endpoint has entered `FALLBACK_TCP`. Fixing only `ReqNotifyCq()` is 
therefore not
   enough to make the fallback work.
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects:
   
   - Breaking backward compatibility: 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to