-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 reload doesn't wait for new process to launch before killing old one #3078
Comments
|
Hmm, you've got a documentation bug at http://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/, then. It's documented there with no indication that it's deprecated.
I'm pretty sure I did this and saw the same behaviour. However, after work tonight I will recreate my test case and try with |
Indeed i took the time to remove it this time. Tell me if its also happening with |
Sorry for delay, but have just confirmed same behaviour with
|
@ExplodingCabbage This could possibly be related to an issue I filed #3143. Can you try reverting commit d0a3f49 and see if you observe the same behavior? I have been unable to get zero-downtime reloads since 2.1.1. It could be another issue as I have only tested with cluster mode. |
Just FYI @brendonboshell, I'm not a contributor or even a user and have never built pm2 - so nah, I'm not inclined to figure out how to run a custom build. Should be trivial for a contributor to follow my instructions above to repro though. |
I can easily reproduce this by delaying the listen command of this example // testpm2reload.js
var http = require("http"),
app = require("express")();
app.use("/", function (req, res) {
return res.send('hello');
});
var server = http.createServer(app);
setTimeout(function () {
server.listen(4000, function () {
process.send('ready');
});
}, 5000)
process.on('SIGINT', function() {
server.close(function(err) {
process.exit(err ? 1 : 0);
});
});
If i see right, pm2 first terminates the currently running process and then starts the new one. So i don't understand how is it possible to get zero downtime (like with naught) ? using pm2 v2.7.2 |
@azazdeaz My understanding (although I could be wrong) is that |
Yes, it is the same if i use --wait-ready for both start and reload |
I commented on another issue and mentioned @Unitech about this. The deprecation warning for Can you clarify its state? |
This question has been bothering me for a long time. I solve this problem by set 'listen_timeout' bigger then default(3s). pm2 listen the 'ready' signal in 3s since you excute pm2 cmd。 so when your app start spend more 3s. please add the paran --listen-timeout=10000 |
I'm having the same issue. |
Hi there, this issue has been reported in 2017, are there any blockers to solve this? I believe the expected behaviour described by @ExplodingCabbage is very reasonable, I'm also testing the |
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. |
Dear stale bot: this is presumably not fixed, and was a serious enough bug that it totally defeated the entire reason I wanted to use this tool 3 years ago; it's pretty egregious that one of the primary advertised features essentially just doesn't work at all. Until this gets fixed, it should remain open. |
I am also having the same issue, anytime PM2 restarts the app, either by running pm2 kill, restart, or start commands or if it restarts on its own due to watch, it gets the "failed to kill" error. in order to clear the error state of the app, i need to go to task manager and kill all node apps running and then run the pm2 start command. Need this to get fixed soon, trying to push this to production but it cant go like this. |
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. |
Go away, stale bot. |
I have this problem as well. Have tried a lot of things but cannot get my Apache Ab tests to run clean during a reload. |
Actually, maybe could someone provide an example where the expected behavior works? |
I finally got this working! The fact that reload only performs as expected in cluster mode should be much more prominently indicated. I got it working by adding this to my exec_mode: 'cluster',
instances: 1, |
I am having this exact issue. We are running the application in
The new version of the process starts, the old one is just stuck in this and I don't know why. |
Hi from 2023 and suddenly facing the same with pm2 latest version, |
Still facing this issue |
What's going wrong?
Graceful reload basically doesn't work at all, as far as I can tell. Am I doing something wrong?
How could we reproduce this issue?
Tail your pm2 logs using
pm2 log
, then run the following test file withpm2 start test.js --kill-timeout 20000 --listen-timeout 20000 --wait-ready
:Then:
curl localhost:1234
(not needed to see that something is wrong)pm2 gracefulReload all
Expected behaviour:
The following things happen in order:
There should be zero downtime with the flow described above.
Observed behaviour
The new process doesn't even launch until the old process is completely terminated, as shown by these logs that are printed when I do
pm2 gracefulReload all
:Supporting information
The docs at http://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/ seem to back up my expectations of what the behaviour should be; they state:
This is very clearly not what's happening here! Am I doing something wrong, or misunderstanding the docs, or is this feature fundamentally broken? I'm pretty confused!
The text was updated successfully, but these errors were encountered: