sonarlint-visualstudio icon indicating copy to clipboard operation
sonarlint-visualstudio copied to clipboard

eslintbridge processes are not shutdown when VS is closed

Open duncanp-lseg opened this issue 4 years ago • 1 comments

Description

If VS does not shut down correctly, the external node process can be left running. They won`t be shut down until the machine is shutdown or it is killed by the user.

The situation currently occurs only with JavaScript files. Once support for TypeScript analysis is released, it will apply to TS file as well. If the user analyses both JS and TS files in a session then there will be two orphaned processes.

Notes: If the node process were a child of the VS process then it would be shut down automatically by Windows when the parent process ended. Were using Process.Start, and a quick check suggests that this would normally create the new process as a child of the current process. However, we aren't launching the node process directly: we're executing a script which launches the node process. This seems to be enough to break the link between the processes.

Repro steps

  1. Start VS and open a JS file so that an external node process is created (the process id is logged in the output window)

  2. Stop the VS process using the task manager

Expected behavior

The node process terminates within a short amount of time.

Actual behavior

The orphaned node process is not shut down until machine shutdown/manually killed

Known workarounds

None

Related information

  • SonarLint for VS Version: v4.34
  • Languages in your solution: JS (and in the future TS)

duncanp-lseg avatar May 21 '21 12:05 duncanp-lseg

We did some investigation, primarily based on job object ids, but couldn't find a solution about it without monitoring on the node application. We also tried these options but did not solve the problem.

https://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed

ugras-ergun-sonarsource avatar Apr 13 '22 09:04 ugras-ergun-sonarsource

Fixed by #3116. The v9.7 of the JS/TS analyzer will shut itself down if it does not receive a regular keep-alive ping from the host -> if VS crashes the pings stop -> the eslintbridge process shuts down.

duncanp-lseg avatar Sep 05 '22 14:09 duncanp-lseg