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 2024/03/12 10:50:50 UTC
(doris) 07/07: [bugfix](becore) be will core when stop because the map is modified during iterator (#32105)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0159a75ceda0256b14bc3604b69b2deed38ff8bc
Author: yiguolei <67...@qq.com>
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 <yi...@gmail.com>
---
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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org