From a2367330fafe0e1742a2b30a242696cd2aee3eac Mon Sep 17 00:00:00 2001 From: zhuofeng <1107893276@qq.com> Date: Thu, 13 Mar 2025 02:08:40 +0000 Subject: [PATCH] fix the sentryCollector service can't be stopped for a long Signed-off-by: zhuofeng <1107893276@qq.com> --- ...llector-service-can-t-be-stopped-for.patch | 61 +++++++++++++++++++ sysSentry.spec | 9 ++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 fix-the-sentryCollector-service-can-t-be-stopped-for.patch diff --git a/fix-the-sentryCollector-service-can-t-be-stopped-for.patch b/fix-the-sentryCollector-service-can-t-be-stopped-for.patch new file mode 100644 index 0000000..d5cce8a --- /dev/null +++ b/fix-the-sentryCollector-service-can-t-be-stopped-for.patch @@ -0,0 +1,61 @@ +From 411e0fe141efdf02d73aa15c2576214af1be787e Mon Sep 17 00:00:00 2001 +From: zhuofeng <1107893276@qq.com> +Date: Wed, 12 Mar 2025 02:27:12 +0000 +Subject: [PATCH] fix the sentryCollector service can't be stopped for a long + time + +Signed-off-by: zhuofeng <1107893276@qq.com> +--- + src/python/sentryCollector/collect_io.py | 13 +++++++++++-- + src/python/syssentry/global_values.py | 2 +- + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/python/sentryCollector/collect_io.py b/src/python/sentryCollector/collect_io.py +index 4cf6534..622e0b4 100644 +--- a/src/python/sentryCollector/collect_io.py ++++ b/src/python/sentryCollector/collect_io.py +@@ -322,6 +322,8 @@ class CollectIo(): + if curr_io_dump > 0: + logging.info(f"ebpf io_dump info : {disk_name}, {stage}, {io_type}, {curr_io_dump}") + IO_GLOBAL_DATA[disk_name][stage][io_type].insert(0, [curr_lat, curr_io_dump, curr_io_length, curr_iops]) ++ if curr_lat > 0: ++ logging.info(f"ebpf info : {disk_name}, {stage}, {io_type}, {curr_lat}, {curr_iops}") + + elapsed_time = time.time() - start_time + sleep_time = self.period_time - elapsed_time +@@ -405,10 +407,17 @@ class CollectIo(): + self + ) -> None: + global EBPF_PROCESS +- if EBPF_PROCESS: ++ if not EBPF_PROCESS: ++ logging.debug("No eBPF process to stop") ++ return ++ try: + EBPF_PROCESS.terminate() ++ EBPF_PROCESS.wait(timeout=3) ++ except subprocess.TimeoutExpired: ++ logging.debug("eBPF process did not exit within timeout. Forcing kill.") ++ EBPF_PROCESS.kill() + EBPF_PROCESS.wait() +- logging.info("ebpf collector thread exit") ++ logging.info("ebpf collector thread exit") + + def main_loop(self): + global IO_GLOBAL_DATA +diff --git a/src/python/syssentry/global_values.py b/src/python/syssentry/global_values.py +index b123b2d..9c7800b 100644 +--- a/src/python/syssentry/global_values.py ++++ b/src/python/syssentry/global_values.py +@@ -114,7 +114,7 @@ class InspectTask: + try: + child = subprocess.Popen(cmd_list, stdout=logfile, stderr=subprocess.STDOUT, close_fds=True) + except OSError: +- logging.error("task %s start Popen error, invalid cmd") ++ logging.error("task %s start Popen error, invalid cmd", cmd_list) + self.result_info["result"] = ResultLevel.FAIL.name + self.result_info["error_msg"] = RESULT_LEVEL_ERR_MSG_DICT.get(ResultLevel.FAIL.name) + self.runtime_status = "FAILED" +-- +2.43.0 + diff --git a/sysSentry.spec b/sysSentry.spec index ed4a410..0f095da 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 31 +Release: 32 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -41,6 +41,7 @@ Patch28: adapt_5.10_kenel_for_syssentry.patch Patch29: collect-module-adapt-to-the-5.10-kernel.patch Patch30: add-avg_block_io-and-ai_block_io.patch Patch31: fix-bug-of-ebpf-and-ai_block_io.patch +Patch32: fix-the-sentryCollector-service-can-t-be-stopped-for.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -358,6 +359,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin* %changelog +* Thu Mar 13 2025 zhuofeng - 1.0.2-32 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix the sentryCollector service can't be stopped for a long + * Fri Feb 14 2025 zhuofeng - 1.0.2-31 - Type:bugfix - CVE:NA -- Gitee