Hang can occur during Python threading
lbiasco-sie opened this issue · comments
Description of Issue
A hang can occur in particular uses of USD with the Python threading library. I debugged it a bit and narrowed my particular case down to the UsdSchemaRegistry
singleton's initialization, and it can be worked around by pre-initializing the registry before starting the threads.
That said, I wouldn't be surprised if this was a more pervasive issue with other singletons or atomic C++ operations.
Steps to Reproduce
- Unzip python_threading_hang_repro.zip and run
python_threading_hang_repro.py
. - Uncomment the registry initializiation (line 16) to not hit the hang.
System Information (OS, Hardware)
Windows 11
Package Versions
USD-24.05
Filed as internal issue #USD-9679
That's weird, @lbiasco-sie - I'm not that familiar with python's threading library, but I'm really curious why we wouldn't run into this when multi-threading in C++. In any case, we'll have a look, and thanks for the repro.
I'm also curious about that. I forgot to mention this in the issue description but I tested the same underlying functions with a simple C++ script, and like you said it worked fine.