Joel Nimety <[email protected]> wrote:
> I'm getting the following errors multiple times per request when using
> 4.3.0.  I do not receive any errors when using 4.2.1.  Please CC me on
> replies, I'm not subscribed to the mailing list.

Multiple times per request?  Yikes.  This can be expected occasionally.

The below patch will just silently ignore them since they're not
errors we can avoid/deal with any other way.  I'd still prefer
exceptions to not get raised at all (they're expensive).

Are the rest of you guys getting these errors intermittently, or only
once in a while.

Rainbows! has long had a similar patch as below, but I'm a bit concerned
as to why Joel is getting this multiple times per request...

>From 04901da5ae0b4655c83be05d24ae737f1b572002 Mon Sep 17 00:00:00 2001
From: Eric Wong <[email protected]>
Date: Fri, 27 Apr 2012 11:48:16 -0700
Subject: [PATCH] http_server: ignore ENOTCONN (mostly from shutdown(2))

Since there's nothing unicorn can do to avoid this error
on unconnected/halfway-connected clients, ignoring ENOTCONN
is a safe bet.

Rainbows! has long had this rescue as it called getpeername(2)
on untrusted sockets
---
 lib/unicorn/http_server.rb |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index f942e2f..14a6f9a 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -507,7 +507,8 @@ class Unicorn::HttpServer
   # the socket is closed at the end of this function
   def handle_error(client, e)
     msg = case e
-    when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF
+    when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF,
+         Errno::ENOTCONN
       Unicorn::Const::ERROR_500_RESPONSE
     when Unicorn::RequestURITooLongError
       Unicorn::Const::ERROR_414_RESPONSE
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to