Search code examples
ruby-on-railsruby-on-rails-3unicorn

Unicorn not reloading with USR2


I'm trying to reload unicorn with a USR2 signal, but I get the following error on the logs:

E, [2012-04-13T21:27:00.801192 #24474] ERROR -- : old PID:23820 running with existing pid=/home/user/app.git/tmp/unicorn.pid.oldbin, refusing rexec

I've search the internets but don't have a clue. It seems that unicorn is trying to write to the pid file? I'm issuing a kill -s USR2 PID

Thanks


Solution

  • I ran into this today. I'm assuming you have previously sent USR2 to unicorn, and this is now the second time you're trying to do so.

    Per the unicorn documentation on signals and USR2: "A separate QUIT should be sent to the original process once the child is verified to be up and running."

    In this particular case, you'd pass the old PID to kill

    kill -s QUIT 23820
    

    Or, you can take advantage of the fact this old PID is stored a known file (referenced in your error message) alongside the "current" PID, and execute:

    kill -s QUIT `cat /home/user/app.git/tmp/unicorn.pid.oldbin`