From 9ad2283db555a38b4951e42001ba884ba2dd86bf Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 Feb 2019 07:24:09 -0600 Subject: [PATCH] mgr/ActivePyModules: do not touch PyFormatter without the GIL Signed-off-by: Sage Weil --- src/mgr/ActivePyModules.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 984cf04b5f35..dca77dc60398 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -104,10 +104,10 @@ PyObject *ActivePyModules::get_server_python(const std::string &hostname) PyObject *ActivePyModules::list_servers_python() { + PyFormatter f(false, true); PyThreadState *tstate = PyEval_SaveThread(); dout(10) << " >" << dendl; - PyFormatter f(false, true); daemon_state.with_daemons_by_server([this, &f, &tstate] (const std::map &all) { PyEval_RestoreThread(tstate); @@ -299,10 +299,10 @@ PyObject *ActivePyModules::get_python(const std::string &what) ); return f.get(); } else if (what == "devices") { - f.open_array_section("devices"); daemon_state.with_devices2( - [&tstate]() { + [&tstate, &f]() { PyEval_RestoreThread(tstate); + f.open_array_section("devices"); }, [&f] (const DeviceState& dev) { f.dump_object("device", dev); -- 2.47.3