From 523b7cafc4c84ef09dbae50cb8311d1694618d45 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 22 Mar 2017 14:10:23 +0800 Subject: [PATCH] mgr: shutdown py_modules in Mgr::shutdown() Fixes: http://tracker.ceph.com/issues/19258 Signed-off-by: Kefu Chai --- src/mgr/Mgr.cc | 3 +++ src/mgr/PyModules.cc | 1 + 2 files changed, 4 insertions(+) diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index facfc2ea646a..6207cd88db2f 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -341,6 +341,9 @@ void Mgr::shutdown() // First stop the server so that we're not taking any more incoming requests server.shutdown(); + // after the messenger is stopped, signal modules to shutdown via finisher + py_modules.shutdown(); + // Then stop the finisher to ensure its enqueued contexts aren't going // to touch references to the things we're about to tear down finisher.wait_for_empty(); diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index 72eda5e58cde..7f2a8f6ca023 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -460,6 +460,7 @@ void PyModules::shutdown() } modules.clear(); + PyGILState_Ensure(); Py_Finalize(); } -- 2.47.3