about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-09 13:58:36 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-09 16:10:38 -0800
commitcf5ba246ac045101a591bbcba57027e7fc5f492b (patch)
tree0541909c8d7f5fe3f5260002ff141cb2c4131fd1
parentf8c283b855eadc18c8f531a8bb2363a4050c9436 (diff)
downloadrainbows-cf5ba246ac045101a591bbcba57027e7fc5f492b.tar.gz
It seems possible to have a race condition here with
the FIFO being overloaded for both start detection
and blocking.  Since SIGSTOP is unavoidable, just use
that instead and sleep immediately afterwards in case
SIGSTOP is not processed in time.
-rw-r--r--t/heartbeat-timeout.ru4
-rwxr-xr-xt/t0004-heartbeat-timeout.sh2
2 files changed, 2 insertions, 4 deletions
diff --git a/t/heartbeat-timeout.ru b/t/heartbeat-timeout.ru
index 471bddc..d9904e8 100644
--- a/t/heartbeat-timeout.ru
+++ b/t/heartbeat-timeout.ru
@@ -1,12 +1,10 @@
 use Rack::ContentLength
-fifo = ENV['FIFO_PATH'] or abort "FIFO_PATH not defined"
 headers = { 'Content-Type' => 'text/plain' }
 run lambda { |env|
   case env['PATH_INFO']
   when "/block-forever"
-    # one of these should block forever
     Process.kill(:STOP, $$)
-    ::File.open(fifo, "rb") { |fp| fp.syswrite("NEVER\n") }
+    sleep # in case STOP signal is not received in time
     [ 500, headers, [ "Should never get here\n" ] ]
   else
     [ 200, headers, [ "#$$\n" ] ]
diff --git a/t/t0004-heartbeat-timeout.sh b/t/t0004-heartbeat-timeout.sh
index 578f619..d7a54a7 100755
--- a/t/t0004-heartbeat-timeout.sh
+++ b/t/t0004-heartbeat-timeout.sh
@@ -7,7 +7,7 @@ t_begin "setup and startup" && {
         rainbows_setup $model
         echo timeout 3 >> $unicorn_config
         echo preload_app true >> $unicorn_config
-        FIFO_PATH=$fifo rainbows -D heartbeat-timeout.ru -c $unicorn_config
+        rainbows -D heartbeat-timeout.ru -c $unicorn_config
         rainbows_wait_start
 }