-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Nodemon Fails to Wait for Process Exit when using Docker + Inspector #1476
Comments
Just started to see this issue when I upgraded to latest versions of nodemon too. Ubuntu 18 Running this with vscode debugging. Worked perfectly fine previously until I did some package upgrades after the event-stream vulnerability.
|
Same issue, but only on Linux. No problem on Mac with Docker For Mac. |
I think this might be solved with the next release going up at the moment - assuming it passes, it'll land in nodemon@1.18.8. @darkobits can you test this once it's up? |
@remy Works for me. Thanks! |
Great thank you for this fix! |
I'm still seeing the issue with |
Same here, less frequent but still there. |
I've updated the demo repo referenced in the original post to nodemon |
@remy, thoughts regarding leaving this closed vs. re-opening? |
I'm seeing intermittent results. Sometimes when I save a file change it restarts correctly.
What I'm forced to do, as shown above, is save again which triggers nodemon to restart.
|
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
Still applicable. |
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
Still persists |
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
I still get this error with |
I also have this problem with |
We are also having this exact issue with |
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
Hello, today I worked on this and I think I have understood what is happening here. First of all it seems, that this is only a Linux related issue (from the comments I see docker and Ubuntu). I had this problem since several weeks with Ubuntu 18. The problem is, that even if you think nodemon starts only one child process, nodemon actually starts two processes: one sh-process AND one node-process (run.js:97). The child.on('exit')-callback in run.js only gets events for the sh-Process (because it's the parent of the node process).
(see https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal) Explicitly waiting for all other See my PR #1579 |
@PePe79 Thank you very much for having worked on the issue and the extensive explanation. Very interesting and I've learned something new about Node. |
Still persits, running on docker:
|
I've been having this issue for a while and my workaround might provide some information. Right before I run However, even when I manually kill the port, I sometimes still get the same :::5000 address in use error. In that case I just kill the port again and it will usually work on the second try. I'm just confused why even when I manually kill the port, I still get the error, and makes me think that maybe nodemon is the one blocking the port? I'm running node v8.11.3 on MacOS 10.14.3. |
Because the issue is on Linux! I hope that delaying it could fix this problem. It seems like @PePe79 has fixed this issue, see PR #1579 @remy I hope you could take a look at his repo/commit. |
[skip ci] * 'master' of https://github.com/pepe79/nodemon: fix: wait for all subprocesses to terminate (fixes issue #1476)
* pepe79-master: fix: wait for all subprocesses to terminate (fixes issue #1476)
👍 |
Hello @remy , sorry to say that, but this issue is back again since version 2.0.2. It was fixed in 2.0.0 and 2.0.1. I just had the chance to upgrade to version 2.0.2 and this issue is back again. I looked at 47dfb8b and I guess the new line |
It seems that when restarting a process, Nodemon isn't waiting for the old process to completely exit before starting a new one, but:
This issue can be intermittent in applications without a shutdown handler. But, having an application that implements a listener for Nodemon's
SIGUSR2
signal that takes even a second or so to complete can be enough to cause this issue to happen reliably.The presence of
--inspect
does cause the new process to immediately crash because its trying to open a debug server on the same port that is still in use by the previous process' debug server, but this merely a side-effect of this issue.If running Nodemon in a Docker container without
--inspect
, Nodemon correctly waits for the old process to exit, but when--inspect
is used inside the container, Nodemon does not wait for the process to exit, leading to an immediate crash.This can be reproduced with Nodemon
1.18.7
and the following:Here is a repo that replicates this issue: https://github.com/darkobits/nodemon-restart-issue.
The text was updated successfully, but these errors were encountered: