diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp index 4930048ed805d5..d4e3cba36cda97 100644 --- a/be/src/runtime/runtime_state.cpp +++ b/be/src/runtime/runtime_state.cpp @@ -434,6 +434,7 @@ Status RuntimeState::append_error_msg_to_file(std::function line, } std::string RuntimeState::get_error_log_file_path() { + std::lock_guard l(_s3_error_log_file_lock); if (_s3_error_fs && _error_log_file && _error_log_file->is_open()) { // close error log file _error_log_file->close(); diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h index 90cf1bc34bdeca..e7f2c18b09404a 100644 --- a/be/src/runtime/runtime_state.h +++ b/be/src/runtime/runtime_state.h @@ -735,6 +735,7 @@ class RuntimeState { std::shared_ptr _s3_error_fs; // error file path on s3, ${bucket}/${prefix}/error_log/${label}_${fragment_instance_id} std::string _s3_error_log_file_path; + std::mutex _s3_error_log_file_lock; }; #define RETURN_IF_CANCELLED(state) \