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

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


The following commit(s) were added to refs/heads/master by this push:
     new 735b898d041 [fix](lock) Fix `~VDataStreamMgr` lock _receiver_map 
(#48057)
735b898d041 is described below

commit 735b898d041c789d2d201b8b844d1478c5d2f3ab
Author: Xinyi Zou <zouxi...@selectdb.com>
AuthorDate: Thu Feb 27 14:07:03 2025 +0800

    [fix](lock) Fix `~VDataStreamMgr` lock _receiver_map (#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 e31a2fbfea5..535f59c49e8 100644
--- a/be/src/vec/runtime/vdata_stream_mgr.cpp
+++ b/be/src/vec/runtime/vdata_stream_mgr.cpp
@@ -44,12 +44,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::shared_lock 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