summary refs log tree commit homepage
diff options
authorEric Wong <>2014-05-02 23:15:58 +0000
committerEric Wong <>2014-05-04 02:32:07 +0000
commit27ae210dde9228cfa96ea6b0f3a7e4047d3f70a4 (patch)
parent9c333bf0c7db34694b8b78c7f03dd2ce89e32890 (diff)
When daemonizing, it is possible for the grandparent to be
terminated by another process before the master can notify
it.  Do not abort the master in this case.

This may fix the following issue:

(which I was notified of privately via email)
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 21cb9a1..a0ca302 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -272,7 +272,11 @@ class Unicorn::HttpServer
     proc_name 'master' "master process ready" # test_exec.rb relies on this message
     if @ready_pipe
-      @ready_pipe.syswrite($$.to_s)
+      begin
+        @ready_pipe.syswrite($$.to_s)
+      rescue => e
+        logger.warn("grandparent died too soon?: #{e.message} (#{e.class})")
+      end
       @ready_pipe = @ready_pipe.close rescue nil