From: Harold Hausman Date: 2005-11-18T11:47:01+09:00 Subject: Question about begin, rescue, end. Here's my code. It's dumb: require 'open-uri' begin while true do the_begin_time = Time.now open( "http://danceliquid.com/test/public/" ) do |stuff| puts stuff.read end the_wait_time = Time.now - the_begin_time the_file = File.new("SitePingLog.txt", "a") the_file.puts('Got it in '+ the_wait_time.to_s + ' seconds @ ' + Time.now.to_s) the_file.close sleep 600 end rescue the_file = File.new("SitePingLog.txt", "a") the_file.puts(Error @ ' + Time.now.to_s) the_file.close retry end #What it does it hit my site every ten minutes, and keep a log of how long it took to get the content there. I was having people tell me that intermittently they wouldn't be able to get to it at all, or sometimes it would be really slow. This script has proven this to be true, and in all honesty I'm not too worried about the performance of my site. My question is, all the open-uri code is inside the begin, rescue section, and occasionally the rescue, end section gets called, but also sometimes (infrequently), the whole script bombs out... here's the error: c:/ruby/lib/ruby/1.8/timeout.rb:42:in `rbuf_fill': execution expired (Timeout::E rror) from c:/ruby/lib/ruby/1.8/net/protocol.rb:196:in `timeout' from c:/ruby/lib/ruby/1.8/timeout.rb:55:in `timeout' from c:/ruby/lib/ruby/1.8/net/protocol.rb:196:in `rbuf_fill' from c:/ruby/lib/ruby/1.8/net/protocol.rb:160:in `readuntil' from c:/ruby/lib/ruby/1.8/net/protocol.rb:171:in `readline' from c:/ruby/lib/ruby/1.8/net/http.rb:1554:in `read_status_line' from c:/ruby/lib/ruby/1.8/net/http.rb:1538:in `read_new' from c:/ruby/lib/ruby/1.8/net/http.rb:833:in `request' ... 9 levels... from c:/ruby/lib/ruby/1.8/open-uri.rb:134:in `open_uri' from c:/ruby/lib/ruby/1.8/open-uri.rb:424:in `open' from c:/ruby/lib/ruby/1.8/open-uri.rb:85:in `open' from C:/Documents and Settings/Harold/Desktop/scripting/ruby/SitePinger. rb:5 ... Right, so, isin't begin, rescue, end supposed to stop exactly this from happening? Or chances are, I've misunderstood. Thanks in advance for your time, -Harold