Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check_client_connection: document local-only requirement

In my testing, only dropped clients over Unix domain sockets or
loopback TCP were detected with this option.  Since many
nginx+unicorn combinations run on the same host, this is not a
problem.

Furthermore, tcp_nodelay:true appears to work over loopback,
so remove the requirement for tcp_nodelay:false.
  • Loading branch information...
commit 90db7b14eab449da8cef4ef22ab76ae00f654361 1 parent 5c700fc
Eric Wong authored
Showing with 8 additions and 7 deletions.
  1. +3 −1 examples/unicorn.conf.rb
  2. +5 −6 lib/unicorn/configurator.rb
View
4 examples/unicorn.conf.rb
@@ -49,7 +49,9 @@
# Enable this flag to have unicorn test client connections by writing the
# beginning of the HTTP headers before calling the application. This
# prevents calling the application for connections that have disconnected
-# while queued.
+# while queued. This is only guaranteed to detect clients on the same
+# host unicorn runs on, and unlikely to detect disconnects even on a
+# fast LAN.
check_client_connection false
before_fork do |server, worker|
View
11 lib/unicorn/configurator.rb
@@ -103,10 +103,6 @@ def commit!(server, options = {}) #:nodoc:
raise ArgumentError,
"check_client_connection is incompatible with tcp_nopush:true"
end
- if set[:listener_opts][address][:tcp_nodelay] == true
- raise ArgumentError,
- "check_client_connection is incompatible with tcp_nodelay:true"
- end
end
end
set.each do |key, value|
@@ -473,8 +469,11 @@ def client_body_buffer_size(bytes)
# This will prevent calling the application for clients who have
# disconnected while their connection was queued.
#
- # This option cannot be used in conjunction with tcp_nodelay or
- # tcp_nopush.
+ # This only affects clients connecting over Unix domain sockets
+ # and TCP via loopback (127.*.*.*). It is unlikely to detect
+ # disconnects if the client is on a remote host (even on a fast LAN).
+ #
+ # This option cannot be used in conjunction with :tcp_nopush.
def check_client_connection(bool)
set_bool(:check_client_connection, bool)
end
Please sign in to comment.
Something went wrong with that request. Please try again.