chenBright commented on PR #3761: URL: https://github.com/apache/brpc/pull/3761#issuecomment-7058948829
Thanks for tracking this down. The old `RdmaEndpoint::PollCq()` could dereference ep after the main socket had been recycled, even just to read `ep->_socket->id()`. #3720 merged after this PR was opened and addresses that race on master, including when SRQ is disabled. The CQ socket now holds a `shared_ptr<RqConnection>`. `RqConnection::PollCq()` uses the `SocketId` saved when that connection was created. If the socket slot has been recycled, the lookup fails and the callback returns. If it succeeds, the callback holds a strong reference to the main socket while accessing the endpoint. It also checks that the CQ socket ID still matches and that the endpoint still owns this connection before polling. CQ context ownership: https://github.com/apache/brpc/blob/51e26d5a6c8f887e55fb959a3c7c2df0b2bac2d4/src/brpc/rdma/rq_connection.h#L90-L96 Callback implementation: https://github.com/apache/brpc/blob/51e26d5a6c8f887e55fb959a3c7c2df0b2bac2d4/src/brpc/rdma/rq_connection.cpp#L923-L939 -- 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]
