sysSentry/fix-the-sentryCollector-service-can-t-be-stopped-for.patch

38 lines
1.3 KiB
Diff
Raw Permalink Normal View History

From 93a58d1e0faee37cbc27981c85f41c50e81bdc66 Mon Sep 17 00:00:00 2001
From: zhuofeng <1107893276@qq.com>
Date: Mon, 24 Feb 2025 03:00:57 +0000
Subject: [PATCH] fix the sentryCollector service can't be stopped for a long
time.
Signed-off-by: zhuofeng <1107893276@qq.com>
---
src/services/sentryCollector/collect_io.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/services/sentryCollector/collect_io.py b/src/services/sentryCollector/collect_io.py
index 10446d9..6db28ec 100644
--- a/src/services/sentryCollector/collect_io.py
+++ b/src/services/sentryCollector/collect_io.py
@@ -405,10 +405,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
--
2.43.0