chenBright commented on PR #3746: URL: https://github.com/apache/brpc/pull/3746#issuecomment-7064024581
> [replied by brpc-oncall robot] Agree with the teardown-order issue above; it should be fixed before merge, so I'm withdrawing my earlier LGTM. > > Guarding the deregistration with `rdma::IsRdmaAvailable()` is the right fix. `GlobalRelease()` stores `g_rdma_available = false` as its first step and then deregisters every MR in `g_user_mrs` itself before deleting the map and the mutex, and `GlobalDisableRdma()` is `LOG(FATAL)`, so teardown is the only transition to "unavailable" — skipping `DeregisterMemoryForRdma()` there cannot leak a registration. > > Please check the flag inside the deleter (at release time, as in `free_storage`) rather than at allocation time: storage is normally released long before teardown, and `PoolExhaustionFallsBackToRegisteredStorage` already relies on the real deregistration path to observe `GetLKey(data) == 0` after the last reference is dropped, so that path must stay intact. @wwbmmm Fixed in aff9c68369801ba19bc4c95889a03b0a22f2ca9e. In the RDMA helper, A process-lifetime mutex now synchronizes MR registration and deregistration with global cleanup. A `Message` destroyed after cleanup can safely free its buffer. If RDMA is disabled while the registry is still live, the last reference still deregisters the buffer. -- 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]
