无法弄清楚这个错误意味着什么(rails Net::OpenTimeout: execution expired) [英] Can't figure out what this error means (rails Net::OpenTimeout: execution expired)
问题描述
我的 rails 应用程序出错:Net::OpenTimeout: execution expired
I got an error on my rails app: Net::OpenTimeout: execution expired
我研究了这个错误,每个人都将它与 Mailer 相关联,我认为这与我无关.这是错误堆栈跟踪:
I researched this error and everyone relates it to Mailer, which I don't think it relates to for me. Here's the error stack trace:
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878 in "initialize"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878 in "open"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878 in "block in connect"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:877 in "connect"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:862 in "do_start"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:851 in "start"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:1367 in "request"
/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51 in "request"
/vendor/bundle/ruby/2.0.0/gems/twilio-ruby-3.11.5/lib/twilio-ruby/rest/client.rb:216 in "connect_and_send"
/vendor/bundle/ruby/2.0.0/gems/twilio-ruby-3.11.5/lib/twilio-ruby/rest/client.rb:168 in "block (2 levels) in <class:Client>"
/vendor/bundle/ruby/2.0.0/gems/twilio-ruby-3.11.5/lib/twilio-ruby/rest/list_resource.rb:91 in "create"
/app/models/message.rb:52 in "send_sms"
/app/controllers/messages_controller.rb:91 in "block in api_send_message"
/app/controllers/messages_controller.rb:81 in "each"
/app/controllers/messages_controller.rb:81 in "api_send_message"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/implicit_render.rb:4 in "send_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:189 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/rendering.rb:10 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/abstract_controller/callbacks.rb:18 in "block in process_action"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:463 in "_run__4571876806874491795__process_action__callbacks"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80 in "run_callbacks"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/abstract_controller/callbacks.rb:17 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/rescue.rb:29 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/instrumentation.rb:31 in "block in process_action"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159 in "block in instrument"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20 in "instrument"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159 in "instrument"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/instrumentation.rb:30 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/params_wrapper.rb:245 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.3/lib/active_record/railties/controller_runtime.rb:18 in "process_action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:136 in "process"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/abstract_controller/rendering.rb:44 in "process"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal.rb:195 in "dispatch"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal/rack_delegation.rb:13 in "dispatch"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_controller/metal.rb:231 in "block in action"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80 in "dispatch"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:48 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:71 in "block in call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59 in "each"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:680 in "call"
/vendor/bundle/ruby/2.0.0/bundler/gems/omnicontacts-0338b3a3ee81/lib/omnicontacts/middleware/base_oauth.rb:41 in "call"
/vendor/bundle/ruby/2.0.0/bundler/gems/omnicontacts-0338b3a3ee81/lib/omnicontacts/builder.rb:27 in "call"
/vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35 in "block in call"
/vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34 in "catch"
/vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/etag.rb:23 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:35 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/params_parser.rb:27 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/flash.rb:241 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225 in "context"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/cookies.rb:486 in "call"
/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.3/lib/active_record/query_cache.rb:36 in "call"
/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:626 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/callbacks.rb:29 in "block in call"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:373 in "_run__2265971570262465834__call__callbacks"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80 in "run_callbacks"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/callbacks.rb:27 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/remote_ip.rb:76 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/debug_exceptions.rb:17 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/show_exceptions.rb:30 in "call"
/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:38 in "call_app"
/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:20 in "block in call"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:67 in "block in tagged"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:25 in "tagged"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:67 in "tagged"
/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/rack/logger.rb:20 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/request_id.rb:21 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17 in "call"
/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/cache/strategy/local_cache.rb:83 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/static.rb:64 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112 in "call"
/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/ssl.rb:24 in "call"
/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/engine.rb:511 in "call"
/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:97 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14 in "call"
/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60 in "service"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138 in "service"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94 in "run"
/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295 in "block in start_thread"
它发生在我通过 twilio 发送短信时,并且只发生过一次.在此之前,我已经发送了 6k 条短信,没有任何问题.这不是问题吗?什么会导致这种情况?
it occurred when I went to send an SMS through twilio and has only happened once. I've sent 6k SMS messages with no issue before this. Is this a non-issue? What would have caused this?
推荐答案
无法弄清楚这个错误意味着什么 Net::OpenTimeout: execution expired
Can't figure out what this error means Net::OpenTimeout: execution expired
这只是一个超时错误.它发生在第三方服务器需要时间响应时.
It is simply a timeout error. It occurs when the third party server take time to respond.
- 后台作业中的第一个移动方法.
- 在发出下一个请求时添加一些延迟.延迟取决于您每秒向第三方服务器发出呼叫的能力或限制.
sleep 5
在大多数情况下都有效. - 如果可能,请发出
batch
请求.
- First move method in the background job.
- add some delay in making next request. The delay depends on how much capable or limit you have to make a call in per sec to the third party server.
sleep 5
is works in most of the case. - If possible, make a
batch
request.
参考文献
这篇关于无法弄清楚这个错误意味着什么(rails Net::OpenTimeout: execution expired)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!