From: Kefu Chai Date: Tue, 7 May 2019 07:06:42 +0000 (+0800) Subject: crimson/osd: shutdown services in the right order X-Git-Tag: v15.1.0~2747^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F27987%2Fhead;p=ceph.git crimson/osd: shutdown services in the right order 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 >::remove_observer(ceph::md_config_obs_impl*) 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 --- diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 157b123b7253..608905b912c6 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -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("fsid"))