ketor opened a new issue, #2237:
URL: https://github.com/apache/brpc/issues/2237

   **Describe the bug (描述bug)**
   There is a bug in function MultiDimension<T>::delete_stats().
   This function use a FlatMap ( MetricMap tmp_map ) and declare a lambda 
function clear_fn to do clear data in the DoublyBufferedData _metric_map.
   
   But the FlatMap ( MetricMap tmp_map ) is not initialized by init() before 
use it to do swap().
   
   This will cause segment fault if call get_stats() after delete_stats().
   
   **To Reproduce (复现方法)**
   Implement a new MulitDimension object and call get_stats() in one thread, 
while another thread do delete_stats() at the same time.
   The DoublyBufferedData data structure is thread-safe, but brpc use a wrong 
method to do delete_stats() which will cause segment fault here.
   
   **Expected behavior (期望行为)**
   No segment fault.
   
   **Versions (各种版本)**
   OS: Ubuntu 22.04/ Rocky 8.x
   Compiler:gcc 11
   brpc:master
   protobuf:3.20.3
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
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