You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2026/04/29 05:02:15 UTC

(doris) branch branch-4.1 updated: branch-4.1: [fix](be) Fix exchange receiver dependency race #62777 (#62885)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new eb796cfac20 branch-4.1: [fix](be) Fix exchange receiver dependency race #62777 (#62885)
eb796cfac20 is described below

commit eb796cfac20731d5a8c138833c2e10875a89b9d0
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Wed Apr 29 13:02:08 2026 +0800

    branch-4.1: [fix](be) Fix exchange receiver dependency race #62777 (#62885)
    
    Cherry-picked from #62777
    
    Co-authored-by: Jerry Hu <hu...@selectdb.com>
---
 be/src/exec/operator/exchange_sink_buffer.cpp     | 23 ++++++++++++++++-------
 be/test/exec/pipeline/vdata_stream_recvr_test.cpp |  2 --
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/be/src/exec/operator/exchange_sink_buffer.cpp b/be/src/exec/operator/exchange_sink_buffer.cpp
index a7ec1092115..34a1c6de666 100644
--- a/be/src/exec/operator/exchange_sink_buffer.cpp
+++ b/be/src/exec/operator/exchange_sink_buffer.cpp
@@ -158,12 +158,12 @@ Status ExchangeSinkBuffer::add_block(Channel* channel, TransmitInfo&& request) {
                                      print_id(channel->_fragment_instance_id));
     }
     auto& instance_data = *_rpc_instances[ins_id];
-    if (instance_data.rpc_channel_is_turn_off) {
-        return Status::EndOfFile("receiver eof");
-    }
     bool send_now = false;
     {
         std::unique_lock<std::mutex> lock(*instance_data.mutex);
+        if (instance_data.rpc_channel_is_turn_off) {
+            return Status::EndOfFile("receiver eof");
+        }
         // Do not have in process rpc, directly send
         if (instance_data.rpc_channel_is_idle) {
             send_now = true;
@@ -199,12 +199,12 @@ Status ExchangeSinkBuffer::add_block(Channel* channel, BroadcastTransmitInfo&& r
                                      print_id(channel->_fragment_instance_id));
     }
     auto& instance_data = *_rpc_instances[ins_id];
-    if (instance_data.rpc_channel_is_turn_off) {
-        return Status::EndOfFile("receiver eof");
-    }
     bool send_now = false;
     {
         std::unique_lock<std::mutex> lock(*instance_data.mutex);
+        if (instance_data.rpc_channel_is_turn_off) {
+            return Status::EndOfFile("receiver eof");
+        }
         // Do not have in process rpc, directly send
         if (instance_data.rpc_channel_is_idle) {
             send_now = true;
@@ -581,6 +581,13 @@ void ExchangeSinkBuffer::_turn_off_channel(RpcInstance& ins,
         for (auto& parent : _parents) {
             parent->on_channel_finished(ins.id);
         }
+    } else {
+        // Task execution context is already gone. The pipeline fragment context is being
+        // destroyed, so on_channel_finished is skipped. This is normally safe because
+        // unblock_all_dependencies() should have already set finish_dependency to always_ready.
+        LOG(INFO) << "ExchangeSinkBuffer::_turn_off_channel: task context is null, "
+                  << "skipping on_channel_finished for instance " << ins.id
+                  << ", dest_node_id=" << _dest_node_id << ", node_id=" << _node_id;
     }
 }
 
@@ -678,7 +685,9 @@ std::string ExchangeSinkBuffer::debug_each_instance_queue_size() {
         for (auto& [_, list] : instance_data->package_queue) {
             queue_size += list.size();
         }
-        fmt::format_to(debug_string_buffer, "Instance: {}, queue size: {}\n", id, queue_size);
+        fmt::format_to(debug_string_buffer, "Instance: {}, queue size: {}, is turn off: {}\n",
+                       fmt::format(FMT_COMPILE("{:x}"), static_cast<uint64_t>(id)), queue_size,
+                       instance_data->rpc_channel_is_turn_off);
     }
     return fmt::to_string(debug_string_buffer);
 }
diff --git a/be/test/exec/pipeline/vdata_stream_recvr_test.cpp b/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
index cab061da1e5..ab6b03b13c5 100644
--- a/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
+++ b/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
@@ -616,6 +616,4 @@ TEST_F(DataStreamRecvrTest, transmit_block) {
     recvr->close();
 }
 
-// ./run-be-ut.sh --run --filter=DataStreamRecvrTest.*
-
 } // namespace doris


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