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

Possible to lose both unicorn masters #114

Open
dsturrock opened this issue Feb 25, 2021 · 0 comments
Open

Possible to lose both unicorn masters #114

dsturrock opened this issue Feb 25, 2021 · 0 comments

Comments

@dsturrock
Copy link

dsturrock commented Feb 25, 2021

Hello all,

Ran into an issue lately where a failed deployment led to unicorn not starting, the old unicorn dying, and the 'upgrade' task returning success.

From looking at the default unicorn_init.rb, it seems to trigger the upgrade, wait 2 seconds, then check if the new master process is still there and kill the old one.

This does mean if there is a problem with the new process after 2 seconds, it will fail, and the old process will be gone so there's nothing to revert back to.

Seems to be a simple fix, the oldsig QUIT instruction doesn't seem to be needed anymore, unicorn will kill the old process once the new master is running successfully and revert back to the old master if the new master fails, so I've taken the olsig QUIT out and let the unicorn behaviour handle this itself.

I also added a check to see if the PID has changed after the upgrade to check if the upgrade was successful.

This gem isn't dependent on a specific unicorn gem or version from what I can see though so in case this behaviour isn't the same everywhere I could implement it as a different task like safe_upgrade rather than making a potentially breaking change to the upgrade task.

#113

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

1 participant