hello-stephen opened a new pull request, #67692: URL: https://github.com/apache/doris/pull/67692
### What problem does this PR solve? Issue Number: N/A Related PR: #66977 Problem Summary: [BE UT build 1040681](http://43.132.222.7:8111/buildConfiguration/Doris_DorisBeUt_BeUt/1040681) hit an ASAN heap-use-after-free in `TableRpcQpsRegistryTest.ConcurrentRecordAndCleanup`. The failure occurs while the cleanup thread destroys a `bvar::Adder` and another thread tears down its TLS agent. The bvar lifetime patch stores each agent's combiner in a `std::weak_ptr`. `Agent::~Agent()` may call `lock()` at the same time as `AgentCombiner::clear_all_agents()` calls `reset()` on that same weak pointer. Concurrent non-const access to the same `weak_ptr` object is not safe and can corrupt the shared ownership control block. This PR: - serializes accesses to each agent's weak pointer; - uses an atomic attachment flag to keep the reducer update hot path lock-free; - repeats the existing concurrent registry test to exercise cross-thread combiner destruction more aggressively. The failing build was for #67679 at `094f6499cbcb58acfaf99f1d0f942454c871b9eb`. That PR only changes zero-argument COUNT aggregate-state files and does not touch this registry or bvar. The registry cleanup path was introduced by #66977. ### Release note None ### Check List (For Author) - Test: - ClangFormat 16 check - Build hygiene check - Applied all brpc patches in build order - GCC 15 C++17 syntax instantiation of the patched `AgentCombiner` - TeamCity BE UT ASAN: pending this PR's exact-SHA run - Behavior changed: No - Does this need documentation: No -- 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]
