Skip to content

[Superseded] Release GIL when polling Runtime API for next invocation #32

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

Closed
wants to merge 1 commit into from

Conversation

carlzogh
Copy link
Contributor

Notes

runtime_client is holding the GIL (Global Interpreter Lock) while it is polling for the runtime/invocation/next invocation, which is meant to be an async I/O operation.

According to the Python extension docs on Initialization, Finalization, and Threads, any blocking I/O should release the lock explicitly to allow other code to continue. This is especially true for extensions where developers (us, in this case) should manage releasing/reacquiring the lock.

Without the lock, even the simplest operations could cause problems in a multi-threaded program: for example, when two threads simultaneously increment the reference count of the same object, the reference count could end up being incremented only once instead of twice.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@carlzogh carlzogh changed the title Release GIL when polling Runtime API for next invocation [Superseded] Release GIL when polling Runtime API for next invocation May 26, 2021
@carlzogh carlzogh closed this May 26, 2021
@carlzogh carlzogh deleted the carlzogh-main branch May 26, 2021 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant