Is it possible to restart Unicorn without downtime?

AI-generated summary

The discussion revolves around restarting Unicorn without downtime. patrickbajao inquires about the safety of using the USR2 signal for a hot restart in Discourse. sam confirms this method is used in Discourse’s Docker manager and provides the necessary code references. To perform the restart, one should send the USR2 signal to the unicorn launcher, which will forward it. tgxworld suggests that a QUIT signal should also be sent, but sam clarifies this is not necessary due to the configuration in unicorn_launcher.

Hi,

I know that we can use sv stop unicorn then sv start unicorn to restart unicorn workers. But that will cause downtime. Killing the master with a USR2 signal is the usual way to do hot restart, as far as I know. Is it still safe to do that for Discourse? Or is there a better way to do this?

I understand that I rarely (or not at all) have to do this. But just want to know in case of emergency.

Thanks!

Sort of, we do:

So you would send the USR2 to the unicorn launcher that will forward the signal for you.

Ah. Sweet! That will do it. Thanks @sam! :slight_smile:

USR2 - reexecute the running binary. A separate QUIT should be sent to the original process once the child is verified to be up and running.

@sam According to the docs, don’t we need to send a QUIT as well?

Nope cause of: