Ruby networking problem on windows
I am running windows XP with ruby 1.8.6 patchlevel 111. I am using HTTP to connect to a remote server and it has been running fine. All of a sudden it started to through the exception listed below (I did not change any code since the last time I ran it successfully). Does anybody know what is going on?
c:/ruby/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::E rror) from c:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' from c:/ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' from c:/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' from c:/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' from c:/ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' from c:/ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' from c:/ruby/lib/ruby/1.8/net/http.rb:1059:in `request' ... 19 levels... from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run' from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run' from c:/ruby/lib/ruby/1.8/test/unit.rb:278 from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader .rb:5 rake aborted! Command failed with status (3): [c:/ruby/bin/ruby -Ilib;test "c:/ruby/lib/r...]
Maybe the remote host is down? Or a new firewall has been put between your machine and the remote host?
"Timeout::Error" usually points to that direction.
besides the obvious (firewall, you got blacklisted for bad user-agent or ignoring robots.txt), you can try curl
http://curl.haxx.se/libcurl/ruby/
OR increase net/http timeout to say, 30+ seconds
http://groups.google.com/group/rubyonrails-talk/msg/cc89e8ae6703d6fb
It could be related to this known Ruby bug where Timeout::Error does not subclass Exception. (fixed in 1.9.2 I believe)
http://lindsaar.net/2007/12/9/rbuf_filltimeout-error
It can be fixed by rescuing from Timeout::Error like rescue Timeout::Error => e
上一篇: Rails,Ruby 1.9.3p0和mysql gem
下一篇: 在Windows上的Ruby网络问题