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

   ### What problem does this PR solve?
   
   Issue Number: resolve
   
   Problem Summary:
   
   `SelectiveChannel::CheckHealth()` and verbose `Describe()` held
   `ChannelBalancer::_mutex` while invoking sub-channel operations. A slow or
   blocking sub-channel could therefore delay concurrent channel management
   operations, including `AddChannel()` and `RemoveAndDestroyChannel()`.
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Snapshot sub-channel `SocketId`s under `ChannelBalancer::_mutex`.
   - Release the lock before resolving and accessing each sub-channel.
   - Use `Socket::AddressFailedAsWell()` and `SocketUniquePtr` to validate the
     versioned ID and keep the Socket alive during access.
   - Add a regression test verifying that verbose `Describe()` does not block
     `AddChannel()`.
   
   Side effects:
   
   - `CheckHealth()` and verbose `Describe()` now use weakly consistent reads:
     channels added after the snapshot are not included, while a concurrently
     removed but still addressable channel may be checked or described once.
     Versioned `SocketId`s and `SocketUniquePtr` ensure invalid or recycled
     sockets are skipped and prevent access to destroyed objects.
   
   - Performance effects:
   
     Reduces lock contention and improves tail latency of channel management
     operations when health checks or verbose descriptions are slow.
   
   - 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