From e7138baf9fb6c3f65ff172e0e4fa1ba6423b152e Mon Sep 17 00:00:00 2001 From: eclipse-ecal-bot <111572016+eclipse-ecal-bot@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:46:32 +0200 Subject: [PATCH] [Python] Fix deadlock: call_method in service now allows threads. (#1760) (#1762) If service and client are located in the same process, the previous implementation of `call_method` caused deadlocks due to the GIL. Co-authored-by: Peguen <73380451+Peguen@users.noreply.github.com> --- 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)); }