diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-09 13:58:36 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-09 16:10:38 -0800 |
commit | cf5ba246ac045101a591bbcba57027e7fc5f492b (patch) | |
tree | 0541909c8d7f5fe3f5260002ff141cb2c4131fd1 /t/heartbeat-timeout.ru | |
parent | f8c283b855eadc18c8f531a8bb2363a4050c9436 (diff) | |
download | rainbows-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.
Diffstat (limited to 't/heartbeat-timeout.ru')
-rw-r--r-- | t/heartbeat-timeout.ru | 4 |
1 files changed, 1 insertions, 3 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" ] ] |