fix: hang when movie plugins invoke python - #1315
Open
rogernelson wants to merge 2 commits into
Open
Conversation
rogernelson
requested review from
bernie-laberge,
cedrik-fuoco-adsk and
eloisebrosseau
as code owners
June 23, 2026 16:08
Signed-off-by: Roger Nelson <roger.nelson@autodesk.com>
rogernelson
force-pushed
the
dev/nelsonr/fix_plugin_python_hang
branch
from
June 23, 2026 16:09
9af832c to
0c67e37
Compare
bernie-laberge
approved these changes
Jun 23, 2026
bernie-laberge
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you @rogernelson !
cedrik-fuoco-adsk
approved these changes
Jun 25, 2026
Signed-off-by: Roger Nelson <roger.nelson@autodesk.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix deadlock when MovieIO Plugins invoke Python
Summarize your change.
If a plugin in the MovieIO plugin folder invokes Python in its initialization, a deadlock will occur. This is because the main thread is holding the GIL (global interpreter lock) when the plugins are initialized (in their own threads). If any of these plugins uses Python it will wait on the GIL held by the main thread, which is waiting on its preloader threads to terminate so deadlock will occur.
The cleanest fix for this is to pass callbacks to MovieIO to avoid introducing a Python dependency in it. We'll add one callback to release any resources (optional) and another to re-acquire them (optional). Then we'll call these before and after our blocking wait on the preloader if they are set.
We'll set this in RvApp where we already initialize a bunch of other statics in RvSession. We'll use this to release the GIL (if we are holding it) and reacquire it (if we were holding it before). We'll use a
thread_localvariable for the GIL state to be correct, even though this shouldn't really ever be called outside of the main thread.Describe the reason for the change.
To avoid deadlock when loading plugins.
Describe what you have tested and on which operating system.
Mac OS 26.5.1
Add a list of changes, and note any that might need special attention during the review.
If possible, provide screenshots.