This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 15d54ba [fix](error-hub) use lock to protect the creation of error
hub (#7605)
15d54ba is described below
commit 15d54bae0e4813a59f05907a95e005e72be38299
Author: Userwhite <[email protected]>
AuthorDate: Sun Jan 9 16:57:31 2022 +0800
[fix](error-hub) use lock to protect the creation of error hub (#7605)
Add a lock when creating error_hub to ensure that no multiple threads
create error_hub
(which could lead to a CORE) #7604
---
be/src/runtime/runtime_state.cpp | 20 ++++++++++++--------
be/src/runtime/runtime_state.h | 1 +
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp
index 6e51936..662d4b5 100644
--- a/be/src/runtime/runtime_state.cpp
+++ b/be/src/runtime/runtime_state.cpp
@@ -464,14 +464,18 @@ const int64_t HUB_MAX_ERROR_NUM = 10;
void RuntimeState::export_load_error(const std::string& err_msg) {
if (_error_hub == nullptr) {
- if (_load_error_hub_info == nullptr) {
- return;
- }
- Status st = LoadErrorHub::create_hub(_exec_env,
_load_error_hub_info.get(),
- _error_log_file_path,
&_error_hub);
- if (!st.ok()) {
- LOG(WARNING) << "failed to create load error hub: " <<
st.get_error_msg();
- return;
+ std::lock_guard<std::mutex> lock(_create_error_hub_lock);
+ if (_error_hub == nullptr) {
+ if (_load_error_hub_info == nullptr) {
+ return;
+ }
+
+ Status st = LoadErrorHub::create_hub(_exec_env,
_load_error_hub_info.get(),
+ _error_log_file_path,
&_error_hub);
+ if (!st.ok()) {
+ LOG(WARNING) << "failed to create load error hub: " <<
st.get_error_msg();
+ return;
+ }
}
}
diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index e0cbd7f..75d4dfb 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -504,6 +504,7 @@ private:
std::string _error_log_file_path;
std::ofstream* _error_log_file = nullptr; // error file path, absolute path
std::unique_ptr<LoadErrorHub> _error_hub;
+ std::mutex _create_error_hub_lock;
std::vector<TTabletCommitInfo> _tablet_commit_infos;
//TODO chenhao , remove this to QueryState
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]