Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

nodemon is leaving one node instance running when it exits? #185

Open
tciuro opened this Issue · 6 comments

5 participants

@tciuro

Hi Remy,

I launch nodemon like this:

Mac:webserv tito$ nodemon app.js 
15 Jun 13:05:08 - [nodemon] v0.7.8
15 Jun 13:05:08 - [nodemon] to restart at any time, enter `rs`
15 Jun 13:05:08 - [nodemon] watching: /Users/tito/Desktop/Tests/webserv
15 Jun 13:05:08 - [nodemon] starting `node app.js`
Express server listening on port 8080 in development mode

I can see two instances of node showing up in Activity Monitor (Mac OS X). If I terminate nodemon via Control-C, one instance is left behind. When I fire nodemon again I get the following:

Mac:webserv tito$ nodemon app.js 
15 Jun 13:07:10 - [nodemon] v0.7.8
15 Jun 13:07:10 - [nodemon] to restart at any time, enter `rs`
15 Jun 13:07:10 - [nodemon] watching: /Users/tito/Desktop/Tests/webserv
15 Jun 13:07:10 - [nodemon] starting `node app.js`
Caught exception: Error: listen EADDRINUSE

Is this expected? Is there anything I can do to make sure nodemon kills the two processes it created when it launched?

Thanks!

@remy
Owner
@taidaishar

I'm seeing the same behavior on Windows 7 with a bare bones express app when running nodemon from a Cygwin terminal. If I run from a regular windows command prompt then it works ok.

@kylekatarnls

I have the same when I do (on a debian):

echo `PORT=8000 nodemon index.coffee > /dev/null 2>&1 & echo $!` > /var/run/myapp.pid
kill -9 $(cat /var/run/myapp.pid)

nodemon exits but node stays.
But with Ctrl+C, no problem.

@remy
Owner

@kylekatarnls by sending the 9 you're sending the SIGKILL signal, which "cannot be caught or ignored.". So nodemon has no time to clean up. You should only use SIGKILL for forceable kill processes. More appropriate is the SIGTERM or 15 to tell nodemon to shutdown.

@kylekatarnls

Thanks!

@bjmiller

I'm using OSX, and I'm getting this error intermittently. It seems that nodemon restarts the process a little too quickly sometimes. Maybe one out of 10+ times? It only started happening recently, but it's happening across multiple computers/projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.