-
Notifications
You must be signed in to change notification settings - Fork 995
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
ONNX Embedding Model Thread-Safety Issue #2152
Comments
I'm working on running this down in ONNX Runtime, and while looking at the Spring AI code I noticed it's closing the |
Link to the ONNX Runtime issue - microsoft/onnxruntime#23555. |
https://github.com/alfredogangemi/spring-ai-onnx-async This is a Spring test project that replicates the error. The operations performed are exactly the same as in my main project, including the files used. You will also find the JVM crash logs and the error file that occurs in other cases. |
Thanks @Craigacp for analysing this issue. this issue. See microsoft/onnxruntime#23555 for more details. |
The root cause of this crash is that ONNX Runtime registers a shutdown hook to close the |
Bug description
When using the default ONNX embedding model in Spring AI (
all-MiniLM-L6-v2
), running the embedding process asynchronously with aThreadPoolTaskExecutor
results in inconsistent behavior and occasional runtime exceptions. The issue does not occur when executing the process synchronously.Environment
Java Version: 17
Spring Boot Version: Latest
Spring AI Version: 1.0.0-M5
Vector Store: Qdrant (though likely unrelated)
ONNX Model: Default (
all-MiniLM-L6-v2
)Steps to reproduce
Configure a ThreadPoolTaskExecutor for handling embedding asynchronously
Call an embedding process asynchronously
Process multiple files in parallel
Expected behavior
The embedding process should run correctly across multiple threads.
Observed behavior
Logs
Other infos
The JVM crashed in some tests:
The text was updated successfully, but these errors were encountered: