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


##########
be/test/exec/pipeline/dummy_task_queue.h:
##########
@@ -53,7 +53,10 @@ class MockTaskScheduler : public TaskScheduler {
 public:
     MockTaskScheduler() : TaskScheduler() { _task_queue = 
std::make_unique<DummyTaskQueue>(1); }
 
-    Status submit(PipelineTaskSPtr task) override { return 
_task_queue->push_back(task); }
+    Status submit(PipelineTaskSPtr task) override {
+        _submit_count++;
+        return _task_queue->push_back(task);
+    }

Review Comment:
   `_submit_count` is incremented and read without synchronization. These 
pipeline tests exercise cross-thread wake-up/scheduler behavior, so this 
introduces a real data race/UB in the test code. Please make the counter 
`std::atomic<int>` (or guard it with a mutex) and update the accessor/reset 
helpers accordingly.



##########
be/src/exec/pipeline/pipeline_task.cpp:
##########
@@ -1050,6 +1050,13 @@ Status PipelineTask::wake_up(Dependency* dep, 
std::unique_lock<std::mutex>& /* d
     _blocked_dep = nullptr;
     auto holder = std::dynamic_pointer_cast<PipelineTask>(shared_from_this());
     RETURN_IF_ERROR(_state_transition(PipelineTask::State::RUNNABLE));
+    // When _wake_up_early is set, FINISHED/FINALIZED → RUNNABLE is a legal 
no-op
+    // (state stays unchanged). We must not resubmit a terminated task to the 
scheduler
+    // because finalize() has already cleared _sink/_operators, and submit() 
would
+    // dereference them (e.g. via is_blockable()) causing a SIGSEGV.
+    if (_exec_state == State::FINISHED || _exec_state == State::FINALIZED) {
+        return Status::OK();
+    }

Review Comment:
   This guard prevents the invalid resubmit, but `wake_up()` still called 
`_state_transition(RUNNABLE)` immediately above. In the delayed wake-up case, 
that transition is a no-op for `_exec_state`, yet `_state_transition()` still 
updates the runtime profile's `TaskState` info string to `RUNNABLE`. After this 
PR, a terminal task can therefore remain `FINISHED`/`FINALIZED` while 
debug/profile output says `RUNNABLE`, which makes diagnosing the race much 
harder. Please move the terminal-state early return before 
`_state_transition(RUNNABLE)`, or make `_state_transition()` skip the 
`TaskState` profile update when the transition is a legal no-op.



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