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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new ebfcbfd25d8 branch-3.0: [fix](lock) Fix ~VDataStreamMgr lock 
_receiver_map #48057 (#49747)
ebfcbfd25d8 is described below

commit ebfcbfd25d8998459322e30c74f2795206fba437
Author: Xinyi Zou <zouxi...@selectdb.com>
AuthorDate: Wed Apr 2 12:13:39 2025 +0800

    branch-3.0: [fix](lock) Fix ~VDataStreamMgr lock _receiver_map #48057 
(#49747)
    
    Cherry-picked from https://github.com/apache/doris/pull/48057
---
 be/src/vec/runtime/vdata_stream_mgr.cpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/be/src/vec/runtime/vdata_stream_mgr.cpp 
b/be/src/vec/runtime/vdata_stream_mgr.cpp
index d499fd8e2b9..8c105b89322 100644
--- a/be/src/vec/runtime/vdata_stream_mgr.cpp
+++ b/be/src/vec/runtime/vdata_stream_mgr.cpp
@@ -41,12 +41,15 @@ VDataStreamMgr::~VDataStreamMgr() {
     // Has to call close here, because receiver will check if the receiver is 
closed.
     // It will core during graceful stop.
     auto receivers = std::vector<std::shared_ptr<VDataStreamRecvr>>();
-    auto receiver_iterator = _receiver_map.begin();
-    while (receiver_iterator != _receiver_map.end()) {
-        // Could not call close directly, because during close method, it will 
remove itself
-        // from the map, and modify the map, it will core.
-        receivers.push_back(receiver_iterator->second);
-        receiver_iterator++;
+    {
+        std::lock_guard<std::mutex> l(_lock);
+        auto receiver_iterator = _receiver_map.begin();
+        while (receiver_iterator != _receiver_map.end()) {
+            // Could not call close directly, because during close method, it 
will remove itself
+            // from the map, and modify the map, it will core.
+            receivers.push_back(receiver_iterator->second);
+            receiver_iterator++;
+        }
     }
     for (auto iter = receivers.begin(); iter != receivers.end(); ++iter) {
         (*iter)->close();


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

Reply via email to