From d41e5364bde413e195df8803845f7232718325a6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 28 Oct 2010 09:03:21 +0000 Subject: t0012: fix race condition in reload We need to ensure the old worker is reaped before sending new requests intended for the new worker. (cherry picked from commit b45bf946545496cf8d69037113533d7a58ce7e20) --- t/t0012-reload-empty-config.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/t0012-reload-empty-config.sh b/t/t0012-reload-empty-config.sh index c18c030..81e1fb3 100755 --- a/t/t0012-reload-empty-config.sh +++ b/t/t0012-reload-empty-config.sh @@ -50,7 +50,10 @@ t_begin "reload signal succeeds" && { do sleep 1 done - + while ! grep reaped < $r_err >/dev/null + do + sleep 1 + done grep 'done reloading' $r_err >/dev/null } -- cgit v1.2.3-24-ge0c7 From a6d96b61c2d81af077d55f43121c8472aa095447 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 17 Nov 2010 11:20:02 -0800 Subject: http_server: fix HttpParserError constant resolution "Unicorn" is no longer in the default constant resolution namespace. (cherry picked from commit 390e351dd1283d4c80a12b744b1327fff091a141) --- 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 69b7cc8..74b2b24 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -491,7 +491,7 @@ class Unicorn::HttpServer msg = case e when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF Unicorn::Const::ERROR_500_RESPONSE - when HttpParserError # try to tell the client they're bad + when Unicorn::HttpParserError # try to tell the client they're bad Unicorn::Const::ERROR_400_RESPONSE else logger.error "Read error: #{e.inspect}" -- cgit v1.2.3-24-ge0c7 From 859593b418db7e5fd93295a7a8b15de56cc4f6dd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 18 Nov 2010 07:44:47 +0800 Subject: tests: add parser error test from Rainbows! This will help ensure we trap our own errors properly in the future. (cherry picked from commit eda408603edc51f10f17217c767b31a45eb6c627) --- t/t0002-parser-error.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 t/t0002-parser-error.sh diff --git a/t/t0002-parser-error.sh b/t/t0002-parser-error.sh new file mode 100755 index 0000000..9a3e7cf --- /dev/null +++ b/t/t0002-parser-error.sh @@ -0,0 +1,31 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 5 "parser error test" + +t_begin "setup and startup" && { + unicorn_setup + unicorn -D env.ru -c $unicorn_config + unicorn_wait_start +} + +t_begin "send a bad request" && { + ( + printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n' + cat $fifo > $tmp & + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x$(cat $ok) +} + +dbgcat tmp + +t_begin "response should be a 400" && { + grep -F 'HTTP/1.1 400 Bad Request' $tmp +} + +t_begin "server stderr should be clean" && check_stderr + +t_begin "term signal sent" && kill $unicorn_pid + +t_done -- cgit v1.2.3-24-ge0c7 From 268c2ec5fef2630b0626b848be9d6ec46d360ddb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 18 Nov 2010 07:42:40 +0800 Subject: unicorn 2.0.1 - fix errors in error handling This release fixes errors in our own error handling, causing certain errors to not be logged nor responded to correctly. Eric Wong (3): t0012: fix race condition in reload http_server: fix HttpParserError constant resolution tests: add parser error test from Rainbows! --- GIT-VERSION-GEN | 2 +- lib/unicorn/const.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0550f7e..2ca4f94 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.0.0.GIT +DEF_VER=v2.0.1.GIT LF=' ' diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 3b324c7..dc75914 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -7,8 +7,8 @@ # improve things much compared to constants. module Unicorn::Const - # The current version of Unicorn, currently 2.0.0 - UNICORN_VERSION = "2.0.0" + # The current version of Unicorn, currently 2.0.1 + UNICORN_VERSION = "2.0.1" # default TCP listen host address (0.0.0.0, all interfaces) DEFAULT_HOST = "0.0.0.0" -- cgit v1.2.3-24-ge0c7