You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StdThread Panic while use load-dynamic and ThreadManager in Windows #441
When enabled load-dynamic feature, loaded onnxruntime from a dylib, and use with_thread_manager to customize thread pool, causing a panic from rust thread.
Possible stopped the thread by onnxruntime
Panic payload: threads should not terminate unexpectedly
Panic location: Some(
Location {
file: "C:\\Users\\a6320\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib/rustlib/src/rust\\library\\std\\src\\thread\\mod.rs",
line: 1767,
column: 14,
},
)
I noted that the lastest build, likely, not provide a dylib.
Here was a prebuilt windows onnxruntime 1.22.1 dylib, with xnnpack, openvino, cuda, directml enabled.
changed the title [-]Panic while use `load-dynamic` and `ThreadManager`[/-][+]StdThread Panic while use `load-dynamic` and `ThreadManager` in Windows[/+]on Jul 23, 2025
Thanks, was able to reproduce. It seems to only happen when the thread manager is used in a global thread pool. Evidently, there's some kind of race condition where something is being unloaded before the threads are joined. That's annoying 😕
Activity
decahedron1 commentedon Jul 23, 2025
Hmm, I can't reproduce this with a simple thread manager that uses
std::thread::spawn&join(). Could you share yourThreadManagerimplementation?greenhat616 commentedon Jul 23, 2025
I updated a reproduce demo at: https://github.com/greenhat616/onnx-reproduce
I used the same ThreadManager impl from examples: https://github.com/greenhat616/onnx-reproduce/blob/main/src/pool.rs
You can simplely test the case by:
[-]Panic while use `load-dynamic` and `ThreadManager`[/-][+]StdThread Panic while use `load-dynamic` and `ThreadManager` in Windows[/+]decahedron1 commentedon Jul 23, 2025
Thanks, was able to reproduce. It seems to only happen when the thread manager is used in a global thread pool. Evidently, there's some kind of race condition where something is being unloaded before the threads are joined. That's annoying 😕
fix: let `Environment` drop, closes pykeio#441
fix(embeddings): prevent ONNX Runtime mutex error during process cleanup
fix(embeddings): prevent ONNX Runtime mutex error during process cleanup
fix(embeddings): prevent ONNX Runtime mutex error during process cleanup
fix(php): handle ONNX Runtime cleanup error in test wrapper
fix(php): handle ONNX Runtime cleanup error in test wrapper
fix(embeddings): prevent ONNX Runtime mutex error during process cleanup
fix(php): handle ONNX Runtime cleanup error in test wrapper