mirror of
https://github.com/apache/doris.git
synced 2026-11-04 07:31:17 +00:00
[fix](runtime) Clear query_ctx_map_delay_delete in FragmentMgr::stop() to avoid UB (#60718)
Related PR: https://github.com/apache/doris/pull/59262 Problem Summary: During BE graceful shutdown, cancel_worker cancels running queries via _get_all_running_queries_from_fe, so clearing _query_ctx_map_delay_delete here won't cause RF consumer to hang. Without this clear, QueryContext destruction in ~FragmentMgr() may attempt to remove itself from _query_ctx_map_delay_delete while the map is being destructed, causing undefined behavior. stack: ``` ~FragmentMgr ~_query_ctx_map_delay_delete ~QueryContext FragmentMgr::remove_query_context _query_ctx_map_delay_delete.erase() ⚠️call function of object that is being destructed ```
This commit is contained in:
1 parent
90ffecd7fb
commit
c137bd2088
1 file changed
+4
@@ -340,6 +340,10 @@ void FragmentMgr::stop() {
|
||||
_thread_pool->shutdown();
|
||||
// Only me can delete
|
||||
_query_ctx_map.clear();
|
||||
// in one BE's graceful shutdown, cancel_worker will get related running queries via _get_all_running_queries_from_fe and cancel them.
|
||||
// so clearing here will not make RF consumer hang. if we dont do this, in ~FragmentMgr() there may be QueryContext in _query_ctx_map_delay_delete
|
||||
// destructred and remove it from _query_ctx_map_delay_delete which is destructring. it's UB.
|
||||
_query_ctx_map_delay_delete.clear();
|
||||
_pipeline_map.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user