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 f35820abcb6 [bugfix](becore) be will core when stop because the map is 
modified during iterator (#32105)
f35820abcb6 is described below

commit f35820abcb6e49ac9419001711223153a15b9692
Author: yiguolei <[email protected]>
AuthorDate: Tue Mar 12 18:37:06 2024 +0800

    [bugfix](becore) be will core when stop because the map is modified during 
iterator (#32105)
    
    Co-authored-by: yiguolei <[email protected]>
---
 be/src/vec/runtime/vdata_stream_mgr.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/runtime/vdata_stream_mgr.cpp 
b/be/src/vec/runtime/vdata_stream_mgr.cpp
index 37cf47f4a36..42e7df4e3cf 100644
--- a/be/src/vec/runtime/vdata_stream_mgr.cpp
+++ b/be/src/vec/runtime/vdata_stream_mgr.cpp
@@ -38,12 +38,17 @@ VDataStreamMgr::VDataStreamMgr() {
 }
 
 VDataStreamMgr::~VDataStreamMgr() {
-    // TODO: metric
+    // 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()) {
-        // Has to call close here, because receiver will check if the receiver 
is closed.
-        // It will core during graceful stop.
-        receiver_iterator->second->close();
+        // 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);
+    }
+    for (auto iter = receivers.begin(); iter != receivers.end(); ++iter) {
+        (*iter)->close();
     }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to