From ddf377a4b1a2a1868f7325f71b8f358fc047ac0f Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 21 Nov 2012 12:04:39 -0800 Subject: [PATCH] rgw: fix cleanup Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_gc.cc | 4 +--- src/rgw/rgw_gc.h | 4 ++++ src/rgw/rgw_main.cc | 10 +++++++--- src/rgw/rgw_rados.cc | 5 ++++- src/rgw/rgw_rados.h | 7 ++++++- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_gc.cc b/src/rgw/rgw_gc.cc index 361e1b04ae0ec..d7861e61250e4 100644 --- a/src/rgw/rgw_gc.cc +++ b/src/rgw/rgw_gc.cc @@ -34,9 +34,7 @@ void RGWGC::initialize(CephContext *_cct, RGWRados *_store) { void RGWGC::finalize() { - for (int i = 0; i < max_objs; i++) { - delete[] obj_names; - } + delete[] obj_names; } int RGWGC::tag_index(const string& tag) diff --git a/src/rgw/rgw_gc.h b/src/rgw/rgw_gc.h index db1753a100fe9..b19afc55dd58c 100644 --- a/src/rgw/rgw_gc.h +++ b/src/rgw/rgw_gc.h @@ -36,6 +36,10 @@ class RGWGC { GCWorker *worker; public: RGWGC() : cct(NULL), store(NULL), max_objs(0), obj_names(NULL), worker(NULL) {} + ~RGWGC() { + stop_processor(); + finalize(); + } void add_chain(librados::ObjectWriteOperation& op, cls_rgw_obj_chain& chain, const string& tag); int send_chain(cls_rgw_obj_chain& chain, const string& tag, bool sync); diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index c8108f1d50b4b..5a4a8fc1a34ea 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -496,11 +496,11 @@ int main(int argc, const char **argv) rest.register_resource(g_conf->rgw_admin_entry, admin_resource); } - RGWProcess process(g_ceph_context, store, g_conf->rgw_thread_pool_size, &rest); + pprocess = new RGWProcess(g_ceph_context, store, g_conf->rgw_thread_pool_size, &rest); - pprocess = &process; + pprocess->run(); - process.run(); + delete pprocess; if (do_swift) { swift_finalize(); @@ -518,6 +518,10 @@ int main(int argc, const char **argv) curl_global_cleanup(); g_ceph_context->put(); + shutdown_async_signal_handler(); + + ceph::crypto::shutdown(); + return 0; } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 6255010785a6d..aa25d507dfb02 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -166,8 +166,11 @@ void RGWRadosCtx::set_prefetch_data(rgw_obj& obj) { void RGWRados::finalize() { - if (use_gc_thread) + if (use_gc_thread) { gc->stop_processor(); + delete gc; + gc = NULL; + } } /** diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 4e0b52d97b729..d8963e2a91e1b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -382,7 +382,12 @@ public: RGWRadosParams params; - virtual ~RGWRados() {} + virtual ~RGWRados() { + if (rados) { + rados->shutdown(); + delete rados; + } + } void tick(); -- 2.39.5