-
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
[fix] cron should gracefully reload process #5636
Comments
We are submitting a pull request now to resolve this issue. The intended behavior by default should perform a graceful reload, as the out of the box behavior should be as smooth as possible for end-users. This change should require a major semver version bump, but a minor at the least. |
titanism
changed the title
[FIX] Cron should gracefully reload process if already running (and restart/start if not already running)
[fix] cron should gracefully reload process if already running (and restart/start if not already running)
Jul 10, 2023
titanism
changed the title
[fix] cron should gracefully reload process if already running (and restart/start if not already running)
[fix] cron should gracefully reload process
Jul 10, 2023
titanism
added a commit
to titanism/pm2
that referenced
this issue
Jul 10, 2023
Per <Unitech#5636>. This should be at minimum a minor semver bump, but recommended major semver bump.
See #5637. |
ping @Unitech |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's going wrong?
Disclosure: We haven't seen this issue on GitHub Issues nor Pull Requests tabs here on GitHub at https://github.com/Unitech/pm2/issues/new, therefore we are filing this is as a new issue. There are related discussion threads on StackOverflow however, see the references below.
Issue: The issue is that the
cron-restart
option does not callreload
, and therefore it does a hard-restart on an existing running application (as opposed to a graceful reload viapm2 reload
). The underlying reason for this is the code below which callsGod.restartProcessId
as opposed toGod.reloadProcessId
(restart
vsreload
).pm2/lib/Worker.js
Line 39 in 311c532
pm2/lib/God/ActionMethods.js
Line 387 in 311c532
pm2/lib/God/Reload.js
Line 218 in 311c532
References:
How could we fix this issue?
Current Workaround: The current workaround is to add the following line to crontab on your server and then modify the paths appropriately. Here are the three steps required to achieve this:
ssh your-server
which node
andwhich pm2
to get the full paths to the executables fornode
andpm2
. In the example below we are usingn
, but your paths may differ slightly, e.g. it may be/usr/local/bin/node
and/usr/local/bin/pm2
.crontab -e
and in the editor (e.g. vim) add the following line to the bottom, then save via:wq
:How to Fix the Issue: To fix this issue, we'd have to open a pull request that modifies the logic as such:
The text was updated successfully, but these errors were encountered: