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

Graceful Shutdown | Best Practices | PM2 Documentation #182

Open
rmonnier9 opened this issue May 30, 2018 · 7 comments
Open

Graceful Shutdown | Best Practices | PM2 Documentation #182

rmonnier9 opened this issue May 30, 2018 · 7 comments

Comments

@rmonnier9
Copy link
Contributor

https://pm2.io/doc/en/runtime/best-practices/graceful-shutdown/

PM2 - Guide, References, Tutorials and Best Practices about PM2 and Node.js.

@ronkorving
Copy link

ronkorving commented Sep 19, 2018

When running via pm2-runtime while developing, hitting CTRL-C causing my app to intercept it twice. I assume that one signal comes from the OS directly to the worker process, and the other signal comes from the parent process (pm2). This is the case even when I run it through pm2-dev. Any suggestions?

@vmarchaud
Copy link
Contributor

I believe OS should only send signal to the main process (in your case pm2-runtime) and pm2 should then broadcast it to every worker. Could you open an issue on the pm2 repo with a sample that reproduce the issue ? Thanks

@hyurl
Copy link

hyurl commented Oct 4, 2018

In cluster mode, there is a default system that sets each cluster ready when the app accepts a connection.

What's that suppose to means of this sentence, does it mean that in cluster mode, I don't have to write my graceful reboot logic at all? What if the default system does't suit my needs, can I rewrite it?

@cahilfoley
Copy link

On Windows (at least Windows Server 2008, 2012, Windows 7 and Windows 10), the message event is never received by the running process as per this document (see issues #3821 and #3467). Is there an alternative method that should be used for achieving a graceful shutdown or reload on Windows?

@negrudev
Copy link

The documentation is nice and clear about the graceful shutdown setup, though, process.on() seems unable to intercept the exit signals of the node process in order to have a graceful shutdown. The events my app listens to are: SIGINT, SIGTERM, uncaughtException. This happens only when running node through pm2. Any solution?

@AlistairHardy
Copy link

Do you have a version of the above examples that handles if a prerequisite service (like mongo) fails to initialise and gracefully shut down any other connections that have been made? In my use case, I'm connecting to MongoDB and RabbitMQ, if their fails, I'd like it to gracefully shut down any other connections after logging to console

@HuihuangZhang
Copy link

The original url is 404. Maybe update to https://doc.pm2.io/en/runtime/best-practices/graceful-shutdown/#graceful-shutdown

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

No branches or pull requests

7 participants