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

   ### What problem does this PR solve?
   
   Issue Number: resolve 
   
   Problem Summary:
   
   Collector uses a leaky singleton, so its destructor never stops its worker 
threads during normal process exit. A pending RPC dump can therefore read 
`rpc_dump_dir` after its string storage has been destroyed, causing a 
heap-use-after-free.
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Add an idempotent shutdown hook that stops and joins both Collector 
threads while retaining the singleton.
   - Ensure Collector shutdown completes before RPC dump flags are destroyed, 
including when Collector was initialized before `main()`.
   - Serialize first-time initialization with shutdown, use an atomic stop 
flag, and reject submissions after shutdown.
   
   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