Killing a child process on the server side crashes VSCode
See original GitHub issueVSCode: 1.55.2 3c4e3df9e89829dce27b7b5c24508306b151f30d x64
OS: macOS Big Sur 11.2.3 (20D91)
Steps to reproduce:
- create a long-standing child process using either
ChildProcess.execFile
orChildProcess.spawn
, trying from either the client side or the server side - after some time,
kill()
the process
Expected: the process dies in both cases
Actual:
- from the client, nothing bad seems to happen
- when the server one is killed, the whole VSCode goes down with
the window has crashed (reason 'killed')
Is there something to do to prevent that?
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Language server keeps crashing on VSCode #179 - GitHub
The Svelte language server on my machine has crashed a few times today. The crashes seem random (i.e I've been unable reproduce them...
Read more >Recommend way to kill child process for VS Code Extension
I have created a child process that I am trying to kill by process id. const { spawn } = require('child_process'); let child ......
Read more >Use Visual Studio Code SSH without crashing your server
Killing the node processes immediately crashed VS Code. More googling taught me that Code silently installs node on your server (already ridiculous), ...
Read more >Fork() Bomb - GeeksforGeeks
Fork Bomb is a program that harms a system by making it run out of memory. It forks processes infinitely to fill memory....
Read more >Queries on large database kill connection to the server, works ...
server process (PID xxx) was terminated by signal 9: Killed: 9. In VS code the error is "lost connection to server" . Two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That makes sense 😃
I don’t think we have to selectively sandbox this scenario given the nature of extension host. Closing for now, @dbaeumer feel free to reopen if you think this deserves further attention.
Oh, thanks to you I found the source of the problem!
The process I am launching is a research tool, which I have now found, in its setup, installs a signal handler for the SIGTERM signal that broadcasts the signal to its entire process group!
It is actually now very easy to reproduce, for instance, by using the following Python “group murder” script:
If you run this script in the language server, it brings down all VSCode instances.
In this light, it actually seems moderately reasonable to not expect the language server to sandbox this entirely. I’ll leave it up to you to decide whether you want this behavior to be prohibited entirely, or whether to close the issue.