]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/log: Fix crash during shutdown with ops-log enable. 61944/head
authorkchheda3 <kchheda3@bloomberg.net>
Thu, 20 Feb 2025 18:53:44 +0000 (13:53 -0500)
committerkchheda3 <kchheda3@bloomberg.net>
Thu, 27 Feb 2025 14:28:36 +0000 (09:28 -0500)
Ensure the env.olog member variable is destructed at last, once all the frontends have stopped accepting new connections and have finished processing the existing connections.

Signed-off-by: kchheda3 <kchheda3@bloomberg.net>
src/rgw/rgw_appmain.cc
src/rgw/rgw_lib.cc
src/rgw/rgw_main.h
src/rgw/rgw_process.cc
src/rgw/rgw_process_env.h

index 2a04ff4ec95d5140740662ed39ff8442d49234fa..ded764dde3973b969cbdbab531c9e8100dbd294f 100644 (file)
@@ -407,7 +407,7 @@ void rgw::AppMain::init_opslog()
     olog_manifold->add_sink(ops_log_file);
   }
   olog_manifold->add_sink(new OpsLogRados(env.driver));
-  olog = olog_manifold;
+  env.olog.reset(olog_manifold);
 } /* init_opslog */
 
 int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
@@ -449,7 +449,6 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
 
   // initialize RGWProcessEnv
   env.rest = &rest;
-  env.olog = olog;
   env.auth_registry = rgw::auth::StrategyRegistry::create(
       dpp->get_cct(), *implicit_tenant_context, env.driver);
   env.ratelimiting = ratelimiter.get();
@@ -597,8 +596,6 @@ void rgw::AppMain::shutdown(std::function<void(void)> finalize_async_signals)
   ldh.reset(nullptr); // deletes ldap helper if it was created
   rgw_log_usage_finalize();
 
-  delete olog;
-
   if (lua_background) {
     lua_background->shutdown();
   }
index 59443c52b02737d29378a33e1fe78165fbe33b5d..5ffb7cf632cc018ee5586c38c4d43becb43e42a0 100644 (file)
@@ -316,7 +316,7 @@ namespace rgw {
               << e.what() << dendl;
     }
     if (should_log) {
-      rgw_log_op(nullptr /* !rest */, s, op, env.olog);
+      rgw_log_op(nullptr /* !rest */, s, op, env.olog.get());
     }
 
     int http_ret = s->err.http_ret;
index d106485855a30be16ac17f75893de94229fbf971..3a729aa630904f320404ff401277627e43f1fc28 100644 (file)
@@ -67,7 +67,6 @@ class AppMain {
   std::vector<RGWFrontendConfig*> fe_configs;
   std::multimap<string, RGWFrontendConfig*> fe_map;
   std::unique_ptr<rgw::LDAPHelper> ldh;
-  OpsLogSink* olog = nullptr;
   RGWREST rest;
   std::unique_ptr<rgw::lua::Background> lua_background;
   std::unique_ptr<rgw::auth::ImplicitTenants> implicit_tenant_context;
index 8d0b020ae57ca3e456aa4661183bca24217b4058..fe1ff8c6e30b11bfc2bb3aa95840edd1aa42c8c9 100644 (file)
@@ -342,7 +342,8 @@ int process_request(const RGWProcessEnv& penv,
           "WARNING: failed to execute pre request script. "
           "error: " << rc << dendl;
       } else {
-        rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
+        rc = rgw::lua::request::execute(driver, rest, penv.olog.get(), s, op,
+                                        script);
         if (rc < 0) {
           ldpp_dout(op, 5) <<
             "WARNING: failed to execute pre request script. "
@@ -440,7 +441,8 @@ done:
           "WARNING: failed to read post request script. "
           "error: " << rc << dendl;
       } else {
-        rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
+        rc = rgw::lua::request::execute(driver, rest, penv.olog.get(), s, op,
+                                        script);
         if (rc < 0) {
           ldpp_dout(op, 5) <<
             "WARNING: failed to execute post request script. "
@@ -459,7 +461,7 @@ done:
     perfcounter->inc(l_rgw_qactive, -1);
   }
   if (should_log) {
-    rgw_log_op(rest, s, op, penv.olog);
+    rgw_log_op(rest, s, op, penv.olog.get());
   }
 
   if (op) {
index 710340f0a259b6ca3558c8de0b86960d5acffcde..d298c15069aac92e718ff191d4b85a6ce006eba1 100644 (file)
@@ -42,7 +42,7 @@ struct RGWProcessEnv {
   rgw::sal::Driver* driver = nullptr;
   rgw::SiteConfig* site = nullptr;
   RGWREST *rest = nullptr;
-  OpsLogSink *olog = nullptr;
+  std::unique_ptr<OpsLogSink> olog;
   std::unique_ptr<rgw::auth::StrategyRegistry> auth_registry;
   ActiveRateLimiter* ratelimiting = nullptr;