From 35d2baf47b2ad29c961da2f861b4d71b65835b00 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Fri, 1 Dec 2017 16:42:44 +0800 Subject: [PATCH] librgw: fix shutdown err with resources uncleaned Fixed: http://tracker.ceph.com/issues/22296 Signed-off-by: Tao Chen (cherry picked from commit 0fa2be059e649684a4fe15a456d564acde8e7831) --- src/rgw/librgw.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 90559f2d351e..023c3622e264 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -24,6 +24,7 @@ #include "include/str_list.h" #include "include/stringify.h" #include "global/global_init.h" +#include "global/signal_handler.h" #include "common/config.h" #include "common/errno.h" #include "common/Timer.h" @@ -61,6 +62,11 @@ bool global_stop = false; +static void handle_sigterm(int signum) +{ + dout(20) << __func__ << " SIGUSR1 ignored" << dendl; +} + namespace rgw { using std::string; @@ -539,6 +545,9 @@ namespace rgw { fec = new RGWFrontendConfig("rgwlib"); fe = new RGWLibFrontend(env, fec); + init_async_signal_handler(); + register_async_signal_handler(SIGUSR1, handle_sigterm); + map service_map_meta; service_map_meta["pid"] = stringify(getpid()); service_map_meta["frontend_type#" + fe_count] = "rgw-nfs"; @@ -573,6 +582,9 @@ namespace rgw { delete fec; delete ldh; + unregister_async_signal_handler(SIGUSR1, handle_sigterm); + shutdown_async_signal_handler(); + rgw_log_usage_finalize(); delete olog; -- 2.47.3