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 <xie.xingguo@zte.com.cn>
(cherry picked from commit
96b7319cc92e13198e05398921404959005c26d9)
Conflicts:
src/mgr/BaseMgrModule.cc : Resolved in ceph_config_set
if (value) {
val = value;
}
+ PyThreadState *tstate = PyEval_SaveThread();
self->py_modules->set_config(self->this_module->get_name(), key, val);
+ PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}