2014-10-10 68 views
-1

我DONO是什麼原因,但我的Ruby程序拋出超時錯誤suddently程序投擲超時錯誤

/home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `initialize': execution expired (Net::OpenTimeout) 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `open' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `block in connect' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:878:in `connect' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:863:in `do_start' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:852:in `start' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1369:in `request' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/consumer.rb:161:in `request' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/tokens/consumer_token.rb:25:in `request' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/tokens/access_token.rb:12:in `request' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/tokens/access_token.rb:27:in `get' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/semantics3-0.04/lib/semantics3.rb:36:in `_make_request' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/semantics3-0.04/lib/semantics3.rb:217:in `run_query' 
from /home/mounarajan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/semantics3-0.04/lib/semantics3.rb:80:in `get_products' 
from project.rb:34:in `block (2 levels) in <main>' 
from project.rb:31:in `each' 
from project.rb:31:in `each_with_index' 
from project.rb:31:in `block in <main>' 
from project.rb:30:in `open' 
from project.rb:30:in `<main>' 

請幫我解決這個問題

+3

從後'project.rb'代碼它是一個問題。 – 2014-10-10 08:27:12

+0

@japed是代碼錯誤還是由於api或互聯網問題? – 2014-10-10 08:47:11

+0

可能,但直到你發佈一些代碼,沒有人能夠幫助你。 – 2014-10-10 08:48:44

回答

0

難道您訪問工作過的Web服務?

然後,它可能不可用,你只能等到再次。

如果您正在爲第一次訪問,可能是防火牆阻止你,或者服務URL沒有被正確地寫入

+0

我的程序正在運行通過5000行的文件。該程序工作後高達1700行,然後它會拋出這樣的錯誤 – 2014-10-10 09:00:25

+0

我不知道你的實現細節。可以肯定的是,在那一刻你正在訪問一個關閉的外部服務......看看你的'lib/semantics3.rb:217'。如果你每行執行不同的請求,那麼你必須猜測哪個服務關閉了。爲此,最好在調用它之前記錄服務名稱 – Fer 2014-10-10 09:05:07

+0

謝謝你會嘗試 – 2014-10-10 09:10:47