iSulad/0217-move-shutdown-handle-after-init-module.patch
2024-10-18 10:47:42 +08:00

44 lines
1.2 KiB
Diff

From aeffc88c7cc0f776fadc7fe19b6db71fc99e763a Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Wed, 19 Jun 2024 10:17:02 +0800
Subject: [PATCH 217/226] move shutdown handle after init module
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/cmd/isulad/main.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c
index 58319ad0..7c7421b4 100644
--- a/src/cmd/isulad/main.c
+++ b/src/cmd/isulad/main.c
@@ -1648,11 +1648,6 @@ static int start_daemon_threads(char **msg)
{
int ret = -1;
- if (new_shutdown_handler()) {
- *msg = "Create new shutdown handler thread failed";
- goto out;
- }
-
if (events_module_init(msg) != 0) {
goto out;
}
@@ -1801,6 +1796,13 @@ int main(int argc, char **argv)
goto failure;
}
+ // after all modules are initialized, enable the shutdown handler to
+ // prevent shutdown handler from cleaning up incompletely initialized modules.
+ if (new_shutdown_handler()) {
+ msg = "Create new shutdown handler thread failed";
+ goto failure;
+ }
+
#ifdef ENABLE_PLUGIN
if (start_plugin_manager()) {
msg = "Failed to init plugin_manager";
--
2.33.0