yiguolei commented on code in PR #32346:
URL: https://github.com/apache/doris/pull/32346#discussion_r1527691150


##########
be/src/runtime/query_context.cpp:
##########
@@ -162,12 +166,13 @@ bool QueryContext::cancel(bool v, std::string msg, Status 
new_status, int fragme
 
     set_ready_to_execute(true);
     {
-        std::lock_guard<std::mutex> plock(pipeline_lock);
         for (auto& ctx : fragment_id_to_pipeline_ctx) {
             if (fragment_id == ctx.first) {
                 continue;
             }
-            ctx.second->cancel(PPlanFragmentCancelReason::INTERNAL_ERROR, msg);
+            if (auto pipeline_ctx = ctx.second.lock()) {

Review Comment:
   we need a lock to protect fragment_id_to_pipeline_ctx.
   For example, one thread is exec_plan_fragment, it will use fragment mgr's 
lock and insert to the map;
   and here, the cancel logic will iterate the map, it may core.
   
   And we should not expose the structure fragment_id_to_pipeline_ctx to 
fragment mgr. 



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to