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/02/26 11:08:09 UTC
(doris) 17/19: Fix cgroup cpu controller file leak (#31398)
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 7b9e500c31a95b5f1bc5e018dc1c48d4979dd978
Author: wangbo <wa...@apache.org>
AuthorDate: Mon Feb 26 18:07:11 2024 +0800
Fix cgroup cpu controller file leak (#31398)
---
be/src/agent/cgroup_cpu_ctl.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/be/src/agent/cgroup_cpu_ctl.cpp b/be/src/agent/cgroup_cpu_ctl.cpp
index ff44e5630e9..c94a3c05f1e 100644
--- a/be/src/agent/cgroup_cpu_ctl.cpp
+++ b/be/src/agent/cgroup_cpu_ctl.cpp
@@ -22,6 +22,8 @@
#include <filesystem>
+#include "util/defer_op.h"
+
namespace doris {
Status CgroupCpuCtl::init() {
@@ -84,6 +86,12 @@ Status CgroupCpuCtl::write_cg_sys_file(std::string file_path, int value, std::st
return Status::InternalError<false>("open path failed, path={}", file_path);
}
+ Defer defer {[&]() {
+ if (-1 == ::close(fd)) {
+ LOG(INFO) << "close file fd failed";
+ }
+ }};
+
auto str = fmt::format("{}\n", value);
int ret = write(fd, str.c_str(), str.size());
if (ret == -1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org