-
Notifications
You must be signed in to change notification settings - Fork 28
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
Acquire the GIL within createPythonPluginSystemManagerImplementationFactory
#797
Comments
Closed
feltech
added a commit
to feltech/OpenAssetIO
that referenced
this issue
Jan 9, 2023
Until OpenAssetIO#797 is properly addressed, add a warning to the Doxygen docs for `createPythonPluginSystemManagerImplementationFactory` that the Python GIL must be acquired before using it. Signed-off-by: David Feltell <david.feltell@foundry.com>
Added #799 to add a warning to the docs until we fix this. So should be removed once the fix is in (updated issue description). |
feltech
added a commit
to feltech/OpenAssetIO
that referenced
this issue
Jan 26, 2023
Fixes OpenAssetIO#797. If the host thread does not hold the GIL when `createPythonPluginSystemManagerImplementationFactory` is called, then segfaults abound when trying to `import` the Python plugin system via pybind11. So ensure the GIL is acquired first. pybind11's `gil_scoped_acquire` is clever enough to restore the state to whatever it was before, upon function exit. Signed-off-by: David Feltell <david.feltell@foundry.com>
feltech
added a commit
to feltech/OpenAssetIO
that referenced
this issue
Jan 26, 2023
Fixes OpenAssetIO#797. If the host thread does not hold the GIL when `createPythonPluginSystemManagerImplementationFactory` is called, then segfaults abound when trying to `import` the Python plugin system via pybind11. So ensure the GIL is acquired first. pybind11's `gil_scoped_acquire` is clever enough to restore the state to whatever it was before, upon function exit. Signed-off-by: David Feltell <david.feltell@foundry.com>
2 tasks
feltech
added a commit
to feltech/OpenAssetIO
that referenced
this issue
Jan 26, 2023
Fixes OpenAssetIO#797. If the host thread does not hold the GIL when `createPythonPluginSystemManagerImplementationFactory` is called, then segfaults abound when trying to `import` the Python plugin system via pybind11. So ensure the GIL is acquired first. pybind11's `gil_scoped_acquire` is clever enough to restore the state to whatever it was before, upon function exit. Signed-off-by: David Feltell <david.feltell@foundry.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What
Ensure the Python GIL is acquired for the duration of
createPythonPluginSystemManagerImplementationFactory
, and restored to it's previous state when that function exits.Update OpenAssetIO-Test-CMake to release the GIL before calling this function.
Why
We don't acquire the GIL within
createPythonPluginSystemManagerImplementationFactory
, so currently the host must acquire it before calling this.The symptom in a Release build is an unhelpful segfault. In a Debug build you get a failed assertion telling you that the GIL must be acquired before importing modules.
Originally posted by @feltech in #554 (comment)
Notes
We should remove the warning added by #799 once this is done.
The text was updated successfully, but these errors were encountered: