From 8985bd5cbc7501a6bbf4aefd66e4ed4dce26f55c Mon Sep 17 00:00:00 2001 From: Peguen <73380451+Peguen@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:44:06 +0200 Subject: [PATCH] [Python] Fix deadlock: call_method in service now allows threads. (#1760) If service and client are located in the same process, the previous implementation of `call_method` caused deadlocks due to the GIL. --- lang/python/core/src/ecal_wrap.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/python/core/src/ecal_wrap.cxx b/lang/python/core/src/ecal_wrap.cxx index 91d0214418..a601493032 100644 --- a/lang/python/core/src/ecal_wrap.cxx +++ b/lang/python/core/src/ecal_wrap.cxx @@ -1120,7 +1120,9 @@ PyObject* client_call_method(PyObject* /*self*/, PyObject* args) // (client_ha PyArg_ParseTuple(args, "nsy#i", &client_handle, &method_name, &request, &request_len, &timeout); bool called_method{ false }; - called_method = client_call_method(client_handle, method_name, request, (int)request_len, timeout); + Py_BEGIN_ALLOW_THREADS + called_method = client_call_method(client_handle, method_name, request, (int)request_len, timeout); + Py_END_ALLOW_THREADS return(Py_BuildValue("i", called_method)); }