Unicorn_rails ignores USR2 signal

Devin Ben-Hur dbenhur at whitepages.com
Wed Mar 21 02:27:41 UTC 2012

On 3/20/12 4:09 PM, Yeung, Jeffrey wrote:
> I have been unable to narrow down the cause of the conflict so far.  The list of Ruby gems (and gem versions) on the affected deployment are identical to the ones on another deployment where Unicorn is upgrading just fine (with preloaded app).  Grep'ing for USR2 in the gem installations did not reveal anything,  unfortunately.  Since then, I haven't been able to spend further time investigating.  Not sure where else to look, really, but I'm open to further suggestions.


To uncover the culprit, you might try monkey-patching Kernel.trap and 
Signal.trap so it logs the last few entries in caller when it's called 
with USR2.

Put something like this really early in you app bootstrap:

[Kernel,Signal].each |klass|
   class << klass
     alias :orig_trap :trap
     def trap *args, &block
       if args.first.to_s =~ /USR2$/i || args.first.to_i == 31
         $stderr.puts "Caught someone trapping USR2 caller is:", 
       orig_trap *args, &block

More information about the mongrel-unicorn mailing list