rack/rack — Issue #274: Tests: Connection refused - connect(2)
Author: bkabrda
Created: 2011-11-25 09:56:07+00:00
State: open

Hi, I was running tests of rack and I got this error:

[2011-11-25 10:48:31] INFO WEBrick 1.3.1
[2011-11-25 10:48:31] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux]
[2011-11-25 10:48:31] INFO WEBrick::HTTPServer#start: pid=13521 port=44372

Errno::ECONNREFUSED: Connection refused - connect(2)
/usr/share/ruby/net/http.rb:762:in `initialize': Rack::Server - should run a server
/usr/share/ruby/net/http.rb:762:in `open'
/usr/share/ruby/net/http.rb:762:in `block in connect'
/usr/share/ruby/timeout.rb:54:in `timeout'
/usr/share/ruby/timeout.rb:99:in `timeout'
/usr/share/ruby/net/http.rb:762:in `connect'
/usr/share/ruby/net/http.rb:755:in `do_start'
/usr/share/ruby/net/http.rb:744:in `start'
/usr/share/ruby/open-uri.rb:306:in `open_http'
/usr/share/ruby/open-uri.rb:775:in `buffer_open'
/usr/share/ruby/open-uri.rb:203:in `block in open_loop'
/usr/share/ruby/open-uri.rb:201:in `catch'
/usr/share/ruby/open-uri.rb:201:in `open_loop'
/usr/share/ruby/open-uri.rb:146:in `open_uri'
/usr/share/ruby/open-uri.rb:677:in `open'
/usr/share/ruby/open-uri.rb:33:in `open'
test/spec_server.rb:66:in `block (2 levels) in '
test/spec_server.rb:52:in `block in '
test/spec_server.rb:7:in `'

I think its connected to the way you synchronize the threads:
until t.status == 'sleep'; t.join(0.01) end
On a faster machine, I think there can be a problem that thread goes asleep and the server is still not fully loaded. If you put sleep(1) after this line or if you extend the join limit to for example 0.1, everything works fine.
Am I missing something or can this really be a test issue on faster systems?

Thank you,
Bohuslav Kabrda.