WolframResearch / WolframLanguageForJupyter

Wolfram Language kernel for Jupyter notebooks
MIT License
1.05k stars 126 forks source link

Dangling Wolfram processes when running in VS Code on Linux #138

Open dechamps opened 2 years ago

dechamps commented 2 years ago

When using the Wolfram kernel in Jupyter running inside the VS Code Jupyter extension on a Linux machine, the WolframKernel and WolframPlayer processes never exit, even after clicking Restart or existing VS Code.

This results in an infinite accumulation of Wolfram processes, which in turn causes various problems, including resource pollution and being unable to start new kernels due to license limits being exceeded by the dangling processes.

I looked into the problem a bit and noticed that WolframKernel and WolframPlayer both seem to ignore SIGTERM signals which is the signal they are being sent in this scenario (verified using gdb).

Ignoring SIGTERM signals seems like a Wolfram Engine bug, which I just reported to support@wolfram.com ([CASE:4971169]). In the meantime maybe the jupyter kernel can be updated to work around this issue, e.g. by sending a different signal on exit?

This is not reproducible using the standard Jupyter Notebook (as opposed to VS Code) because the Wolfram processes appear to be sent SIGINT (which they handle correctly) in this case.