stockfish.wasm
stockfish.wasm copied to clipboard
How to kill process created by Stockfish()?
When you execute Stockfish() it creates an instance of something (engine I guess?) that sits in memory until the main process is killed. Is it possible to kill that thing someway without killing main thread?
I'm running stockfish.wasm on Node.JS server.
Unfortunately I don't know a clean way. It's possible to call sf.terminate()
given sf
is an instance, but it does not work reliably:
https://github.com/lichess-org/lila/blob/5d26cf97458fa3772d21dee65a61d217058e617b/ui/ceval/src/worker.ts#L204-L206
It's possible to call
sf.terminate()
givensf
is an instance, but it does not work reliably
Yes, it does nothing. The workaround is to encapsulate everything in separate worker process and kill that worker when it's needed.