about summary refs log tree commit homepage
path: root/t/t9100-thread-timeout.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-20 00:54:17 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-20 03:42:55 +0000
commit7e0dc42f7084e1719456a80b2e44049133c2e8b7 (patch)
treec9840f4eb56cc365664425b40b94978f43c40ed8 /t/t9100-thread-timeout.sh
parent886e0a006d9e8e9c586beae28ed4dc5097064e90 (diff)
downloadrainbows-7e0dc42f7084e1719456a80b2e44049133c2e8b7.tar.gz
This was causing unrelated requests to get killed every
+timeout+ seconds, instead of only the ones that were
running too long.

Noticed-by: ghazel@gmail.com
ref:
http://mid.gmane.org/AANLkTi=7OhyTwkHsp_rXU7Gp1PokihiQ9bJigpO-BfN6@mail.gmail.com
Diffstat (limited to 't/t9100-thread-timeout.sh')
-rwxr-xr-xt/t9100-thread-timeout.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/t9100-thread-timeout.sh b/t/t9100-thread-timeout.sh
index ab46e5a..0f802dd 100755
--- a/t/t9100-thread-timeout.sh
+++ b/t/t9100-thread-timeout.sh
@@ -5,7 +5,7 @@ ThreadSpawn|ThreadPool|RevThreadSpawn|RevThreadPool) ;;
 *) t_info "$0 is only compatible with Thread*"; exit 0 ;;
 esac
 
-t_plan 5 "ThreadTimeout Rack middleware test for $model"
+t_plan 6 "ThreadTimeout Rack middleware test for $model"
 
 t_begin "configure and start" && {
         rtmpfiles curl_err
@@ -25,6 +25,26 @@ t_begin "sleepy request times out with 408" && {
         grep 408 $curl_err
 }
 
+t_begin "short requests do not timeout while making a long one" && {
+        rm -f $ok $curl_err
+        > $ok
+        curl -sSf http://$listen/2 2>$curl_err >/dev/null &
+        (
+                for i in $(awk </dev/null 'BEGIN{for(i=20;--i>=0;)print i}')
+                do
+                        curl -sSf http://$listen/0.1 >> $ok 2>&1 &
+                        test x"HI" = x"$(curl -sSf http://$listen/0.05)"
+                done
+                wait
+        )
+        test x"HI" = x"$(curl -sSf http://$listen/)"
+        wait
+        test -f $ok
+        test 20 -eq $(grep '^HI$' $ok | wc -l)
+        test x = x"$(grep -v '^HI$' $ok)"
+        grep 408 $curl_err
+}
+
 t_begin "kill server" && {
         kill $rainbows_pid
 }