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

Running nodemon terminal process is not killed at restart/close #87321

Closed
fabb opened this issue Dec 19, 2019 · 11 comments
Closed

Running nodemon terminal process is not killed at restart/close #87321

fabb opened this issue Dec 19, 2019 · 11 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *not-reproducible Issue cannot be reproduced by VS Code Team member as described terminal Integrated terminal issues
Milestone

Comments

@fabb
Copy link

fabb commented Dec 19, 2019

This is a duplicate of the closed bug #56217 which still happens in the current version in combination with nodemon. The original issue is locked, therefore I created a new issue.

Issue Type: Bug

  • Start nodemon with any server in the VSCode terminal
  • Quit VSCode

The 2 node processes from nodemon will keep running.

Note that when instead of quitting VSCode, aborting the process with CTRL + C, the node processes are removed correctly.

In my concrete use case, I have a next.js app, and after such a VSCode close and restart, I cannot start my app again since it will fail with an error Error: listen EADDRINUSE: address already in use :::3002.

I would expect all running processes in terminals to be quit when VSCode closes, also in the case of nodemon.

@vscodebot
Copy link

vscodebot bot commented Dec 19, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the tasks Task system issues label Dec 19, 2019
@alexr00 alexr00 added terminal Integrated terminal issues and removed tasks Task system issues labels Dec 19, 2019
@alexr00 alexr00 assigned Tyriar and unassigned alexr00 Dec 19, 2019
@Tyriar
Copy link
Member

Tyriar commented Dec 30, 2019

It looks like your report is missing some important information, See this wiki page for more info on how to report actionable terminal issues.

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Dec 30, 2019
@fabb
Copy link
Author

fabb commented Jan 4, 2020

Allright, here is more information:

VS Code version: Code 1.41.1 (26076a4, 2019-12-18T14:57:51.166Z)
OS version: Darwin x64 19.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz (4 x 2800)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 3
Memory (System) 16.00GB (3.22GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (32)
Extension Author (truncated) Version
rainbow-brackets 2gu 0.0.6
Bookmarks ale 10.6.0
scratchpads bue 0.0.7
path-intellisense chr 1.4.2
dart-code Dar 3.7.1
flutter Dar 3.7.1
vscode-eslint dba 2.0.11
gitlens eam 10.2.0
clipboard-manager Edg 1.2.0
EditorConfig Edi 0.14.4
vscode-npm-script eg2 0.3.10
prettier-vscode esb 3.18.0
todo-tree Gru 0.0.162
search-node-modules jas 1.3.0
vscode-styled-components jpo 0.0.27
intellij-idea-keybindings k-- 0.2.37
vscode-apache mrm 1.2.0
vscode-docker ms- 0.9.0
vscode-typescript-tslint-plugin ms- 1.2.3
vsliveshare ms- 1.0.1404
debugger-for-chrome msj 4.12.3
color-highlight nau 2.3.0
abracadabra nic 3.0.0
java red 0.55.1
vscode-sort-json ric 1.18.0
partial-diff ryu 1.4.0
stylelint shi 0.51.0
vscode-java-debug vsc 0.24.0
vscode-icons vsc 9.7.0
quokka-vscode Wal 1.0.267
vscode-todo-highlight way 1.0.4
glean wix 4.19.0
Relevant parts of settings.json { "explorer.confirmDragAndDrop": false, "files.autoSave": "onFocusChange", "window.restoreWindows": "all", "editor.formatOnSave": true, "window.zoomLevel": 0, "terminal.integrated.env.osx": { "SOLARIZED_THEME": "light" }, "terminal.integrated.shell.osx": "/bin/zsh", "terminal.integrated.scrollback": 100000, }

I am not using an extension to launch the terminal.

Note that I can reproduce it with my next.js app, but not when I directly run node test-server.js in the terminal.

Do you need more info like trace logs for this issue?

@fabb
Copy link
Author

fabb commented Jan 4, 2020

I tried to reproduce the issue with a new next.js project, but could not. In my project I use a custom server with nodemon, I wonder if that is related to the issue. Maybe nodemon does some weird stuff when registering file watchers that cannot be exited fast enough when receiving the exit signal when VSCode quits?

@fabb fabb changed the title Kill running terminal processes at restart / close Kill running terminal processes at restart / close (maybe related to nodemon only) Jan 4, 2020
@fabb
Copy link
Author

fabb commented Jan 4, 2020

It's definitely nodemon. Here is a demonstration:

nodemon

The server.js is very simple:

console.log('server started')
setInterval(() => {})

@fabb fabb changed the title Kill running terminal processes at restart / close (maybe related to nodemon only) Running nodemon terminal process is not killed at restart/close Jan 4, 2020
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 6, 2020
@Tyriar
Copy link
Member

Tyriar commented Jan 6, 2020

Not yet confirmed

@faabiopontes
Copy link

It just happened to me using zsh on VS Code and outside of it on Ubuntu

@tonyito
Copy link

tonyito commented Jul 17, 2021

Happened to me on Windows 10 with nodemon, after restarting VSCode I tried running nodemon again and it said the port is being used

@Profesor08
Copy link

process.on("SIGHUP", () => {
  process.exit(1);
});

@Tyriar
Copy link
Member

Tyriar commented Oct 11, 2021

I can't reproduce, if this does happen to you, try listening for SIGHUP as mentioned above.

@Tyriar Tyriar added the *not-reproducible Issue cannot be reproduced by VS Code Team member as described label Oct 11, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *not-reproducible Issue cannot be reproduced by VS Code Team member as described terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

8 participants
@fabb @Tyriar @faabiopontes @rzhao271 @Profesor08 @tonyito @alexr00 and others