我的rails应用程序出错:Net :: OpenTimeout:执行过期
我研究了这个错误,每个人都将它与Mailer联系起来,我认为这与我无关。这是错误堆栈跟踪:
/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短信,没有任何问题。这不是问题吗?会造成什么?
答案 0 :(得分:3)
无法弄清楚此错误意味着Net :: OpenTimeout:执行已过期
这只是一个超时错误。它发生在第三方服务器需要时间响应时。
sleep 5
在大多数情况下都适用。 batch
个请求。 答案 1 :(得分:2)
短信服务网址没有收到任何回复。由于没有响应而请求处理失败,并且已超过请求的等待时间。服务连接问题,因此您遇到了超时
答案 2 :(得分:1)
我在我的API中使用此短信服务在手机上发送消息,之前遇到此错误。这是服务器的连接问题。应用程序正在向服务URL发送请求,并且它已经等待了一段时间,当没有收到响应并且等待时间已经超过时,请求执行因超时而停止,并且rails发出了此错误。