質問

I got an error on my rails app: Net::OpenTimeout: execution expired

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"

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?

役に立ちましたか?

解決

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.

Solution

  1. First move method in the background job.
  2. 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.
  3. If possible, make a batch request.

References

  1. What are the limits on outbound calls and SMS messages per-second?
  2. Using Twilio SMS API, can I specify multiple destination phones in one post?
  3. How to send bulk SMS with twilio API

他のヒント

There is no response received from SMS service url. Processing of request failed due to no response and waiting time for request has been exceeded. connectivity issue with service, so you experienced timeout

I have used this SMS service in my API to send messages on mobile phones, have experienced this error before. This is the connectivity issue with server. Application is sending request to the service url and it has waited for certain amount of time, when no response is received and waiting time has exceeded, the request execution was halted due to time out and rails gave this error.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top