pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

pm2-runtime: wait-ready not supported?

Open adi87 opened this issue 6 years ago • 2 comments

What's going wrong?

CLI options --wait-ready and --listen-timeout are unsupported when using pm2-runtime

How could we reproduce this issue?

pm2-runtime start server.js -i 2 --wait-ready --listen-timeout 30000

  error: unknown option `--wait-ready'

Supporting information

We run an application in Docker that runs 2 instances for failover purposes. However due to the time it takes to connect to various databases and connections, upon a restart after a crash, it could take up to 20 seconds for the process to start listening to connections. Before we moved to docker, we were using the wait_ready option which worked perfectly.

However now, pm2-runtime thinks our restarted process is online even though it's not and starts routing requests to the node. This in turn causes our load balancers to think the container is unhealthy because it gets a 502 from the newly started process that isn't ready yet which then causes the container to be removed from the cluster and results in undesirable behavior.

Our current workaround is increasing the health check interval from the loadbalancer, but we'd like to get this done right. Any insight is appreciated.

Thank you for the project by the way, we've been using it in production for many years now, and it's been a life saver many times over.

adi87 avatar Jun 03 '20 02:06 adi87

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 03 '20 02:07 stale[bot]

@adi87 I just leave this in case somebody stumbles upon the same issue:

Yes, [email protected] is still not working with --wait-ready.

Use this alternative: pm2 start --wait-ready -config pm2.config.json; pm2 logs all

gram7gram avatar Jan 12 '21 08:01 gram7gram