[DRE-commits] [unicorn] 01/02: Add patch to improve handling of client-triggerable socket errors
Hleb Valoshka
tsfgnu-guest at alioth.debian.org
Sat Aug 17 09:46:33 UTC 2013
This is an automated email from the git hooks/post-receive script.
tsfgnu-guest pushed a commit to branch master
in repository unicorn.
commit 700f6915d2090c6c5a7cef7a545f0da66ae6382e
Author: Hleb Valoshka <375GNU at Gmail.COM>
Date: Sat Aug 17 12:35:56 2013 +0300
Add patch to improve handling of client-triggerable socket errors
Taken from upstream commit 24b9f66d.
---
...explicitly-use-escaped-minus-in-man-pages.patch | 10 ++---
...-improve-handling-of-client-triggerable-s.patch | 46 ++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/debian/patches/0001-explicitly-use-escaped-minus-in-man-pages.patch b/debian/patches/0001-explicitly-use-escaped-minus-in-man-pages.patch
index c015bde..44237ca 100644
--- a/debian/patches/0001-explicitly-use-escaped-minus-in-man-pages.patch
+++ b/debian/patches/0001-explicitly-use-escaped-minus-in-man-pages.patch
@@ -3,12 +3,12 @@ Date: Thu, 27 Sep 2012 22:40:49 +0300
Subject: explicitly use escaped minus in man pages
---
- man/man1/unicorn.1 | 32 ++++++++++++++++----------------
- man/man1/unicorn_rails.1 | 34 +++++++++++++++++-----------------
- 2 files changed, 33 insertions(+), 33 deletions(-)
+ man/man1/unicorn.1 | 34 +++++++++++++++++-----------------
+ man/man1/unicorn_rails.1 | 34 +++++++++++++++++-----------------
+ 2 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/man/man1/unicorn.1 b/man/man1/unicorn.1
-index 0b496af..749272a 100644
+index 2401be4..b4d22de 100644
--- a/man/man1/unicorn.1
+++ b/man/man1/unicorn.1
@@ -4,7 +4,7 @@
@@ -133,7 +133,7 @@ index 0b496af..749272a 100644
require a specified LIBRARY before executing the application.
The "require" statement will be executed immediately and in the
order they were specified on the command-line.
-@@ -194,7 +194,7 @@ If needed, they should be individually specified in the
+@@ -194,7 +194,7 @@ If needed, they must be individually specified in the RACKUP_FILE,
some frameworks do not require them.
.SH ENVIRONMENT VARIABLES
.PP
diff --git a/debian/patches/0002-http_server-improve-handling-of-client-triggerable-s.patch b/debian/patches/0002-http_server-improve-handling-of-client-triggerable-s.patch
new file mode 100644
index 0000000..1960e0e
--- /dev/null
+++ b/debian/patches/0002-http_server-improve-handling-of-client-triggerable-s.patch
@@ -0,0 +1,46 @@
+From: Eric Wong <normalperson at yhbt.net>
+Date: Sat, 17 Aug 2013 01:20:11 +0000
+Subject: http_server: improve handling of client-triggerable socket errors
+
+We do not attempt to write HTTP responses for socket errors if
+clients disconnect from us unexpectedly.
+
+Additionally, we do not hide backtraces EINVAL/EBADF errors, since
+they are indicative of real bugs which must be fixed.
+
+We do continue to hide hide EOF, ECONNRESET, ENOTCONN, and EPIPE
+because clients (even "friendly") ones will break connections due to
+client crashes or network failure (which is common for me :P), and
+the backtraces from those will cause excessive logging and even
+become a DoS vector.
+---
+ lib/unicorn/http_server.rb | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
+index cc0a705..bed24d0 100644
+--- a/lib/unicorn/http_server.rb
++++ b/lib/unicorn/http_server.rb
+@@ -520,9 +520,8 @@ class Unicorn::HttpServer
+ # the socket is closed at the end of this function
+ def handle_error(client, e)
+ code = case e
+- when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF,
+- Errno::ENOTCONN
+- 500
++ when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::ENOTCONN
++ # client disconnected on us and there's nothing we can do
+ when Unicorn::RequestURITooLongError
+ 414
+ when Unicorn::RequestEntityTooLargeError
+@@ -533,7 +532,9 @@ class Unicorn::HttpServer
+ Unicorn.log_error(@logger, "app error", e)
+ 500
+ end
+- client.kgio_trywrite(err_response(code, @request.response_start_sent))
++ if code
++ client.kgio_trywrite(err_response(code, @request.response_start_sent))
++ end
+ client.close
+ rescue
+ end
diff --git a/debian/patches/series b/debian/patches/series
index dd6652b..0532401 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
0001-explicitly-use-escaped-minus-in-man-pages.patch
+0002-http_server-improve-handling-of-client-triggerable-s.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/unicorn.git
More information about the Pkg-ruby-extras-commits
mailing list