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


##########
be/src/exec/pipeline/dependency.cpp:
##########
@@ -77,9 +77,42 @@ void Dependency::set_ready() {
         local_block_task.swap(_blocked_task);
     }
     for (auto task : local_block_task) {
-        if (auto t = task.lock()) {
-            std::unique_lock<std::mutex> lc(_task_lock);
-            THROW_IF_ERROR(t->wake_up(this, lc));
+        try {
+            if (auto t = task.lock()) {
+                try {
+                    std::unique_lock<std::mutex> lc(_task_lock);
+                    THROW_IF_ERROR(t->wake_up(this, lc));
+                } catch (const doris::Exception& e) {
+                    if (t->is_finalized()) {
+                        // Task already completed, wake_up failure is expected 
and benign.
+                    } else {
+                        // Task is not finalized but wake_up failed — it may 
be stuck in BLOCKED
+                        // with no one to reschedule it. Cancel the query to 
prevent a hang.
+                        LOG(WARNING)
+                                << "Dependency::set_ready(): wake_up failed 
for non-finalized "
+                                   "task, cancelling query. dep="
+                                << _name << ", status=" << e.code() << ": " << 
e.to_string();
+                        if (auto frag = t->fragment_context().lock()) {

Review Comment:
    is called from  on a raw  ( /  both forward here), and this new branch now 
does much more than the old code path: it logs, builds  objects, and calls  
over the whole fragment. Per , non-task background threads need  before doing 
that kind of work; otherwise those allocations run without an attached runtime 
thread context on the exact exceptional path we are trying to harden.
   
   Please initialize thread context in the timer thread before calling into 
this recovery path, or hand cancellation off to an already-attached execution 
thread instead.



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