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


##########
be/src/exec/pipeline/pipeline_fragment_context.cpp:
##########
@@ -598,10 +621,7 @@ Status 
PipelineFragmentContext::_build_pipeline_tasks(ThreadPool* thread_pool) {
     }
     auto pipeline_id_to_profile = 
_runtime_state->build_pipeline_profile(_pipelines.size());
 
-    if (target_size > 1 &&
-        (_runtime_state->query_options().__isset.parallel_prepare_threshold &&
-         target_size > 
_runtime_state->query_options().parallel_prepare_threshold)) {
-        // If instances parallelism is big enough ( > 
parallel_prepare_threshold), we will prepare all tasks by multi-threads

Review Comment:
   [P1] Avoid dangling parallel-prepare callbacks when worker bootstrap fails. 
When this new predicate selects the branch, `submit_func` can enqueue the `[&, 
i]` lambda before `ThreadPool::do_submit()` creates a worker. If the fragment 
pool has zero live workers and `create_thread()` fails, `do_submit()` returns 
an error but leaves that lambda queued; `arrive_and_wait(target_size - 
submitted_tasks)` discounts it and `FragmentMgr` returns/destroys the 
`PipelineFragmentContext` and the stack `prepare_status`/`latch`. A later 
submission that starts a worker will then run the queued lambda and dereference 
those dead references (and `this`). Make the first submission/worker bootstrap 
atomic or remove/drain the queued callback before returning the bootstrap 
error, and ensure no callback can outlive these captures.



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