My scenario is this:
There is a Python system plugin, which is attached to my model.
I use TestFixture in Python to run the server with this model, however, due to GIL not being explicitly released in the PythonSystemLoader, the TestFixture cannot execute its python method.
The error I got was as follows:
Implementation suggestion
To overcome this issue, we need to do a scoped_acquire of GIL explicitly and then perform scoped_release after each of the system methods, namely, PreUpdate, Update, PostUpdate of the PythonSystem, so the GIL can be accessed by the TestFixture after.
As a safety mechanism, for future, I also added the scoped_acquire and release of GIL within the pybind code for TestFixture.
After fixing the results are as follows:
Desired behavior
My scenario is this: There is a Python system plugin, which is attached to my model. I use TestFixture in Python to run the server with this model, however, due to GIL not being explicitly released in the PythonSystemLoader, the TestFixture cannot execute its python method. The error I got was as follows:
Implementation suggestion
To overcome this issue, we need to do a scoped_acquire of GIL explicitly and then perform scoped_release after each of the system methods, namely, PreUpdate, Update, PostUpdate of the PythonSystem, so the GIL can be accessed by the TestFixture after. As a safety mechanism, for future, I also added the scoped_acquire and release of GIL within the pybind code for TestFixture. After fixing the results are as follows:
Additional context
OS: Ubuntu 22.04 GZ Harmonic