Eric Wong
2014-May-02 23:15 UTC
[RFC/PATCH] http_server: handle premature grandparent death
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: https://github.com/kostya/eye/issues/49 (which I was notified of privately via email) --- Will push and tag 4.8.3 this weekend (along with mailing list change). lib/unicorn/http_server.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 @@ def join proc_name 'master' logger.info "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 end begin -- Eric Wong __ http://bogomips.org/unicorn-public/ - unicorn-public@bogomips.org please quote as little as necessary when replying