Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonSystemLoader does not release GIL, which causes issues when running a server with a python system #2613

Open
AmalDevHaridevan opened this issue Sep 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@AmalDevHaridevan
Copy link

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:

Screenshot from 2024-09-10 12-18-29

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:
Screenshot from 2024-09-10 12-20-26

Additional context

OS: Ubuntu 22.04
GZ Harmonic

@AmalDevHaridevan AmalDevHaridevan added the enhancement New feature or request label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Inbox
Development

No branches or pull requests

1 participant