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
I use the onnxruntime-node in the electron app with web worker. When I first create the web worker, it's OK. But, when I create the web worker again, the app will breakdown.
To reproduce
A vue component
<scriptsetup>
import {ref} from "vue";
const num = ref(0)
let worker = undefined
function startWorker() {if(worker===undefined){worker=newWorker('./worker.js')worker.onmessage=function(event){num.value=event.data;};}}functionterminateWorker(){if(worker!==undefined){worker.terminate()}
worker = undefined
}</script><template><v-btn @click="startWorker">
start worker
</v-btn><v-btn @click="terminateWorker">endworker</v-btn><div>{{num}}</div></template><stylescoped></style>
If I delete the last line, I can restart the worker for many times. If I add the last line, if I restart the web worker, the app will crash. I suspect that is because the inferenceSession may not be closed properly when the worker is terminated. However, I can not find any api to close the inferenceSession. Another finding is that the memory is not released after the web worker is terminated.
Urgency
No response
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
"onnxruntime-node": "^1.12.1",
Execution Provider
Other / Unknown
The text was updated successfully, but these errors were encountered:
I use the onnxruntime-node in the electron app with web worker. When I first create the web worker, it's OK. But, when I create the web worker again, the app will breakdown.
If you use onnxruntime-node in an electron app, the code should be running in the backend (ie. worker threads in Node), not in the frontend (web worker in Chromium).
Thanks for your help. The problem still exist after I remove the cuda backend. I have move the code to the main process. However, I still have a question. Is there any function to close the InferenceSession.
Describe the issue
I use the onnxruntime-node in the electron app with web worker. When I first create the web worker, it's OK. But, when I create the web worker again, the app will breakdown.
To reproduce
A vue component
The worker.js
If I delete the last line, I can restart the worker for many times. If I add the last line, if I restart the web worker, the app will crash. I suspect that is because the inferenceSession may not be closed properly when the worker is terminated. However, I can not find any api to close the inferenceSession. Another finding is that the memory is not released after the web worker is terminated.
Urgency
No response
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
"onnxruntime-node": "^1.12.1",
Execution Provider
Other / Unknown
The text was updated successfully, but these errors were encountered: