From 2b6dd7653211d3d6b4cb6a46eec11bbde8cab789 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 18 Feb 2011 17:02:08 -0800 Subject: clear listeners array on SIGQUIT We don't want to repeatedly reclose the same IOs and keep raising exceptions this way. --- lib/unicorn/http_server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 3a35d7d..db150f3 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -582,7 +582,7 @@ class Unicorn::HttpServer # closing anything we IO.select on will raise EBADF trap(:USR1) { nr = -65536; SELF_PIPE[0].close rescue nil } - trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil } } + trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil }.clear } [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } } # instant shutdown logger.info "worker=#{worker.nr} ready" m = 0 -- cgit v1.2.3-24-ge0c7