question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Killing a child process on the server side crashes VSCode

See original GitHub issue

VSCode: 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 or ChildProcess.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:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
deepak1556commented, Apr 15, 2021

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.

0reactions
Ptivalcommented, Apr 15, 2021

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:

#! /usr/bin/env python
import os, signal
os.killpg(os.getpgid(os.getpid()), signal.SIGTERM)

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found