Permalink
Browse files

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
  • Loading branch information...
1 parent 8c1aff1 commit 04901da5ae0b4655c83be05d24ae737f1b572002 Eric Wong committed Apr 27, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/unicorn/http_server.rb
@@ -507,7 +507,8 @@ def maintain_worker_count
# 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

0 comments on commit 04901da

Please sign in to comment.