Hello guys.

I have one problem with some ruby script I developed. This look a basic
issue to solve, but I did try several things and till now I didn't find
a solution...
This script is basically to do some http requests to trackers. I'm
getting this following exception some time after I start the script:

/usr/lib/ruby/1.8/timeout.rb:60:in `extract_information': execution
expired
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:113:in `run'
from /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:111:in `run'
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:103:in `each'
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:103:in `run'
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:76:in `each'
from /home/user/NetBeansProjects/trackers/lib/trackers.rb:76:in `run'
from /home/user/NetBeansProjects/trackers/lib/main.rb:11

So, the script starts but after a while (the time varies) I get the
above exception.

The structure of the code is like this:

run()
...
 infohash.each{ |hash,info|
  ...
  trackers.each{ |t|
    url = ...
    a, b = extract_information(url) #<----------------- Error line(113)
  }
 }
end

extract_information(url)
 begin
  Timeout::timeout(3) do
    #http call to url
  end
 rescue Timeout::Error => e
 rescue SystemCallError => e
 ...
 end
end

So, as you can see in extract_information(url) function I handled the
Timeout::Error, so I dont get why is giving the Timeout error. I also
added a timeout in run() function to handle the extract_information(url)
call, like this:

...
 begin
  Timeout::timeout(60) do
   a, b = foo(url) #<------------ Error line
  end
 rescue Timeout::Error =>e
 rescue SystemCallError => e
 end

but the result was the same...
Any clues?

Thanks,

Luis

-- 
Posted via http://www.ruby-forum.com/.