github-actions[bot] commented on code in PR #63722:
URL: https://github.com/apache/doris/pull/63722#discussion_r3309075709


##########
be/src/load/group_commit/group_commit_mgr.cpp:
##########
@@ -615,17 +751,72 @@ GroupCommitMgr::GroupCommitMgr(ExecEnv* exec_env) : 
_exec_env(exec_env) {
                               
.set_max_threads(config::group_commit_insert_threads)
                               .build(&_thread_pool));
     _all_block_queues_bytes = std::make_shared<std::atomic_size_t>(0);
+    _create_plan_thread = std::thread(&GroupCommitMgr::_create_plan_worker, 
this);
 }
 
 GroupCommitMgr::~GroupCommitMgr() {
+    stop();
     LOG(INFO) << "GroupCommitMgr is destoried";
 }
 
 void GroupCommitMgr::stop() {
+    {
+        std::lock_guard<std::mutex> l(_need_create_plan_lock);
+        if (_stopped) {
+            return;
+        }
+        _stopped = true;
+    }
+    _need_create_plan_cv.notify_all();
+    if (_create_plan_thread.joinable()) {
+        _create_plan_thread.join();
+    }
     _thread_pool->shutdown();
     LOG(INFO) << "GroupCommitMgr is stopped";

Review Comment:
   This is a new long-lived `std::thread` entry point, but it starts executing 
BE code without initializing the Doris thread context. Per the BE runtime 
convention, non-task background threads should enter with 
`SCOPED_INIT_THREAD_CONTEXT()` so allocations/logging/status construction done 
by the worker are associated with a valid thread-local memory context instead 
of becoming untracked. Please include `runtime/thread_context.h` and initialize 
the context at the start of `_create_plan_worker()` (or use the existing Doris 
thread wrapper pattern if preferred).



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