From: xie xingguo Date: Sat, 30 Mar 2019 03:15:49 +0000 (+0800) Subject: mgr/BaseMgrModule: drop GIL in set_config X-Git-Tag: v15.0.0~7^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=96b7319cc92e13198e05398921404959005c26d9;p=ceph.git mgr/BaseMgrModule: drop GIL in set_config Holding GIL and run mon_command turns out to be easily deadlock-prone. https://tracker.ceph.com/issues/35985 is a typical report, and here is another. Fix by using PyModuleConfig's own lock for protection of concurrent accesses, which should be sufficient enough. Fixes: http://tracker.ceph.com/issues/39040 Signed-off-by: xie xingguo --- diff --git a/src/mgr/BaseMgrModule.cc b/src/mgr/BaseMgrModule.cc index 899a8917e600..87eda069d502 100644 --- a/src/mgr/BaseMgrModule.cc +++ b/src/mgr/BaseMgrModule.cc @@ -443,7 +443,9 @@ ceph_set_module_option(BaseMgrModule *self, PyObject *args) if (value) { val = value; } + PyThreadState *tstate = PyEval_SaveThread(); self->py_modules->set_config(module, key, val); + PyEval_RestoreThread(tstate); Py_RETURN_NONE; }