Should USR2 always work?

Eric Wong normalperson at
Mon Nov 21 20:16:31 EST 2011

Laurens Pit <laurens.pit at> wrote:
> I didn't expect that to be the case, but in the past year occasionally
> I've experienced I had to resort to QUIT and start all over in order
> to get all components loaded correctly.
> Specifically: yesterday I upgraded several projects to rails 3.0.11
> and added a new i18n .yml file in the config dir. After the USR2 QUIT
> sequence all new code seemed to work fine. Except the new .yml file
> wasn't loaded. Another run of USR2 and QUIT didn't resolve it. Only
> after QUIT and start of unicorn was the new .yml file loaded.
> This was not just on one machine, which might have been a fluke. This
> was on all machines for all projects, consistently.
> Any ideas?

Anything from stderr log files?  USR2 will fail if there's

* compile/load error when loading the app (if preload_app=true)

* unicorn/unicorn_rails executable script is missing
  (maybe Bundler is moving it?)

* Ruby installation got moved/shifted/changed

* Working directory got _moved_ (cap may cycle those out)
  You can set "working_directory" in your unicorn config
  to work around it.

  (and maybe other reasons I can't think of right now)

Come to think of it, the missing working directory case
could be the most common...

But stderr log files (stderr_path) should always tell you what's
going on.

== Linux(-only?) tip:

If the log files got deleted somehow, you may still be able to read it
via: "cat /proc/$PID/fd/2" on either the PID of the master or _any_
worker process.

To read some other log files, you can just replace the "2" with whatever
file descriptor.  Reading the symlinks ("ls -l /proc/$PID/fd/") will
tell you where each descriptor is pointed to, even if it is a deleted

More information about the mongrel-unicorn mailing list