]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/log: Fix crash during shutdown with ops-log enable. 62134/head
authorkchheda3 <kchheda3@bloomberg.net>
Thu, 20 Feb 2025 18:53:44 +0000 (13:53 -0500)
committerkchheda3 <kchheda3@bloomberg.net>
Wed, 5 Mar 2025 14:55:15 +0000 (14:55 +0000)
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>
(cherry picked from commit 374ddbc0e8767feda1d596517451293371211cc5)

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 13b5ee8a0db1a34dddbde65bc0149030abb36f4b..73d645e45abc00929dba6f592d1facc55ee5be32 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();
@@ -593,8 +592,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 36bf2b253550da264693db68852d7b3ee28661d8..c1c16a88d9763dbf547de32a0f6247058f18216e 100644 (file)
@@ -335,7 +335,7 @@ int process_request(const RGWProcessEnv& penv,
     } else if (rc < 0) {
       ldpp_dout(op, 5) << "WARNING: failed to read 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. error: " << rc << dendl;
       }
@@ -425,7 +425,7 @@ done:
     } else if (rc < 0) {
       ldpp_dout(op, 5) << "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. error: " << rc << dendl;
       }
@@ -441,7 +441,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 (http_ret != nullptr) {
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;