]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: shutdown services in the right order 27987/head
authorKefu Chai <kchai@redhat.com>
Tue, 7 May 2019 07:06:42 +0000 (15:06 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 7 May 2019 07:06:43 +0000 (15:06 +0800)
we should stop config service *after* osd is stopped, as osd depends on
a working and alive config subsystem when stopping itself. for instance,
the destructor of AuthRegistry unregisters itself from the ObserverMgr,
which is in turn a member variable of ConfigProxy, so if ConfigProxy is
destroyed before we destroy mon::Client, we will have a segfault with
following backtrace

ObserverMgr<ceph::md_config_obs_impl<ceph::common::ConfigProxy>
>::remove_observer(ceph::md_config_obs_impl<ceph::common::ConfigProxy>*)
at /var/ssd/ceph/build/../src/common/config_obs_mgr.h:78
AuthRegistry::~AuthRegistry() at
/var/ssd/ceph/build/../src/crimson/common/config_proxy.h:101
 (inlined by) AuthRegistry::~AuthRegistry() at
/var/ssd/ceph/build/../src/auth/AuthRegistry.cc:28
ceph::mon::Client::~Client() at
/var/ssd/ceph/build/../src/crimson/mon/MonClient.h:44
ceph::mon::Client::~Client() at
/var/ssd/ceph/build/../src/crimson/mon/MonClient.h:44
OSD::~OSD() at /usr/include/c++/9/bits/unique_ptr.h:81

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/main.cc

index 157b123b72531192e9657b50cd2e5e511b6fd3dc..608905b912c6b9ae3af96d28cb016bb0573fe3b4 100644 (file)
@@ -96,7 +96,13 @@ int main(int argc, char* argv[])
       auto& config = app.configuration();
       return seastar::async([&] {
         sharded_conf().start(init_params.name, cluster_name).get();
+        seastar::engine().at_exit([] {
+          return sharded_conf().stop();
+        });
         sharded_perf_coll().start().get();
+        seastar::engine().at_exit([] {
+          return sharded_perf_coll().stop();
+        });
         local_conf().parse_config_files(conf_file_list).get();
         local_conf().parse_argv(ceph_args).get();
         const int whoami = std::stoi(local_conf()->name.get_id());
@@ -128,13 +134,6 @@ int main(int argc, char* argv[])
                                            hb_front_msgr.stop(),
                                            hb_back_msgr.stop());
         });
-        seastar::engine().at_exit([] {
-          return sharded_perf_coll().stop();
-        });
-        seastar::engine().at_exit([] {
-          return sharded_conf().stop();
-        });
-
         if (config.count("mkfs")) {
           osd.invoke_on(0, &OSD::mkfs,
                         local_conf().get_val<uuid_d>("fsid"))