diff options
author | Eric Wong <e@80x24.org> | 2014-02-01 20:23:22 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-02-01 20:23:22 +0000 |
commit | 9b565f1808a16bc63e9e15e2cbe77d947c502706 (patch) | |
tree | d90927d9abb79138b6f6e88725ffe7f60f87d50c /lib/unicorn | |
parent | cce86f545998d16e4e5d4160aa6f1beed8a2df80 (diff) | |
download | unicorn-9b565f1808a16bc63e9e15e2cbe77d947c502706.tar.gz |
We close SELF_PIPE in the worker immediately, but signal handlers do not get setup immediately. So prevent workers from erroring out due to invalid SELF_PIPE.
Diffstat (limited to 'lib/unicorn')
-rw-r--r-- | lib/unicorn/http_server.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 2052d53..21cb9a1 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -120,6 +120,7 @@ class Unicorn::HttpServer # this pipe is used to wake us up from select(2) in #join when signals # are trapped. See trap_deferred. SELF_PIPE.replace(Unicorn.pipe) + @master_pid = $$ # setup signal handlers before writing pid file in case people get # trigger happy and send signals as soon as the pid file exists. @@ -133,7 +134,6 @@ class Unicorn::HttpServer # we upgrade and the upgrade breaks during preload_app==true && build_app! self.pid = config[:pid] - self.master_pid = $$ build_app! if preload_app bind_new_listeners! @@ -390,6 +390,7 @@ class Unicorn::HttpServer end def awaken_master + return if $$ != @master_pid SELF_PIPE[1].kgio_trywrite('.') # wakeup master process from select end |