简体   繁体   English

Windows上的Ruby网络问题

[英]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. 我正在使用ruby 1.8.6 patchlevel 111运行Windows XP。我正在使用HTTP连接到远程服务器,并且它运行良好。 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. “ Timeout :: Error”通常指向该方向。

besides the obvious (firewall, you got blacklisted for bad user-agent or ignoring robots.txt), you can try curl 除了明显的问题(防火墙,您因用户代理错误或忽略robots.txt而被列入黑名单),还可以尝试curl

http://curl.haxx.se/libcurl/ruby/ http://curl.haxx.se/libcurl/ruby/

OR increase net/http timeout to say, 30+ seconds 或增加net / http超时,例如30+秒

http://groups.google.com/group/rubyonrails-talk/msg/cc89e8ae6703d6fb 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. 这可能与该已知的Ruby错误有关,在该错误中,Timeout :: Error不将Exception子类化。 (fixed in 1.9.2 I believe) (我相信在1.9.2中已修复)

http://lindsaar.net/2007/12/9/rbuf_filltimeout-error http://lindsaar.net/2007/12/9/rbuf_filltimeout-error

It can be fixed by rescuing from Timeout::Error like rescue Timeout::Error => e 可以通过抢救Timeout :: Error来进行修复,例如rescue Timeout::Error => e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM