Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.7k
Description
Created per@remy's request inthis issue.
It seems that when restarting a process, Nodemon isn't waiting for the old process to completely exit before starting a new one, but:
- only when in a Docker container and
- only when the inspector/debug mode is active.
This issue can be intermittent in applications without a shutdown handler. But, having an application that implements a listener for Nodemon'sSIGUSR2 signal that takes even a second or so to complete can be enough to cause this issue to happen reliably.
The presence of--inspectdoes 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, Nodemondoes not wait for the process to exit, leading to an immediate crash.
This can be reproduced with Nodemon1.18.7 and the following:
$ node -vv10.13.0$ docker -vDocker version 18.09.0, build 4d60db4$ docker-compose -vdocker-compose version 1.23.1, build b02f1306Here is a repo that replicates this issue:https://github.com/darkobits/nodemon-restart-issue.