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

add restart option #102

Closed
achimkoellner opened this issue Dec 15, 2015 · 2 comments
Closed

add restart option #102

achimkoellner opened this issue Dec 15, 2015 · 2 comments

Comments

@achimkoellner
Copy link

I refer to #16

Is the fact that {background: true} as a default option makes express:stop not to wait until the server stopped (and hands the task back to grunt) and then later express:dev tries to start a server that it is not yet shut down?
I experience the issue when my watch task runs the default grunt task. It stops the server, builds my app which takes 2-3 seconds, then start the server, gets the error EADDRINUSE (as stop didn't happen yet) and then - after that - I get prompted "Stopping Express Server" - so stop seams to happen after start, that'swhy the server is not running after the first time the watcher triggered the process.
I would think a "restart" option that starts OR restarts the service would be awesome.

This is my configuration:

    express: {
        options: {
            port: 3000,
            background: true
        },
        dev: {
            options: {
                script: 'application/server/app.js'
            }
        }
    }

My default task looks like that

    grunt.registerTask('default', [
            'notify:buildStart',
            'express:dev:stop',
            'command:removeTmpCss',
            'jshint:js',
            'compass',
            'express:dev',
            'notify:buildComplete',
            'watch'
    ]);
@jlsutherland
Copy link
Collaborator

Hi @achimkoellner,

This issue seems to arise with new versions of node. Processes spun up by newer versions of node don't respond to SIGTERM in the same way that they used to. I've put up a PR that I would expect to merge as soon as I run a few more checks (see #99)---it solves the EADDRINUSE issue. If you'd like, feel free to try it out and follow up!

In the mean time, if you need a quick fix to stop the process: run ps -a | grep node and see what the process id is for your sticky processes. Then kill -9 {pid here}.

This was referenced Dec 16, 2015
@jlsutherland
Copy link
Collaborator

Merged #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants