Skip to content
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

How to kill process created by Stockfish()? #38

Open
pronode opened this issue Jan 11, 2023 · 2 comments
Open

How to kill process created by Stockfish()? #38

pronode opened this issue Jan 11, 2023 · 2 comments

Comments

@pronode
Copy link

pronode commented Jan 11, 2023

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.

@niklasf
Copy link
Member

niklasf commented Jan 11, 2023

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

@pronode
Copy link
Author

pronode commented Jan 26, 2023

It's possible to call sf.terminate() given sf 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants