Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to catch Net::ReadTimeout #100

Open
mhluska opened this issue Oct 22, 2018 · 1 comment
Open

Failing to catch Net::ReadTimeout #100

mhluska opened this issue Oct 22, 2018 · 1 comment

Comments

@mhluska
Copy link

mhluska commented Oct 22, 2018

It seems this is unable to retry on certain exceptions like Net::ReadTimout. Here's my stack trace:

     1.1) Failure/Error: find('[href="/videos"]').click

          Net::ReadTimeout:
            Net::ReadTimeout



          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/webmock-3.3.0/lib/webmock/http_lib_adapters/net_http.rb:97:in `block in request'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/webmock-3.3.0/lib/webmock/http_lib_adapters/net_http.rb:110:in `block in request'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/webmock-3.3.0/lib/webmock/http_lib_adapters/net_http.rb:109:in `request'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:121:in `response_for'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:76:in `request'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/common.rb:62:in `call'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/oss/bridge.rb:584:in `execute'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/oss/bridge.rb:562:in `find_elements_by'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/search_context.rb:78:in `find_elements'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/selenium/driver.rb:77:in `find_css'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/base.rb:97:in `find_css'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/queries/selector_query.rb:137:in `find_nodes_by_selector_format'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/queries/selector_query.rb:102:in `block in resolve_for'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/base.rb:77:in `synchronize'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/queries/selector_query.rb:101:in `resolve_for'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/finders.rb:288:in `block in synced_resolve'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/base.rb:82:in `synchronize'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/finders.rb:286:in `synced_resolve'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/node/finders.rb:33:in `find'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/session.rb:728:in `block (2 levels) in <class:Session>'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/capybara-3.8.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
          # ./spec/system/affiliate_spec.rb:34:in `block (2 levels) in <main>'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:123:in `block in run'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `loop'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `run'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
          # ./spec/spec_helper.rb:123:in `block in setup_rspec_retry'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:123:in `block in run'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `loop'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `run'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
          # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:37:in `block (2 levels) in setup'

It looks like this library calls ex.run which throws the Net::ReadTimeout error and RSpec fails to put it into example.exception? Would this benefit from a begin/rescue around the ex.run call for these catastrophic cases?

@glennfu
Copy link

glennfu commented Jun 14, 2019

I have a similar thing going on with mine. On my CI server, ActiveRecord::ConnectionNotEstablished is sometimes raised. rspec-retry will never retry it. If I manually add to a spec raise ActiveRecord::ConnectionNotEstablished then rspec-retry WILL retry it. This is with rspec 3.7.1 and rspec-retry 0.6.1

Relevant stack trace:

Failure/Error: raise ConnectionNotEstablished unless @automatic_reconnect
     
     ActiveRecord::ConnectionNotEstablished:
       ActiveRecord::ConnectionNotEstablished
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:772:in `checkout_new_connection'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:752:in `try_to_checkout_new_connection'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:713:in `acquire_connection'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:490:in `checkout'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/fixtures.rb:1010:in `map'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/fixtures.rb:1010:in `enlist_fixture_connections'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/fixtures.rb:980:in `setup_fixtures'
     # /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-5.0.7/lib/active_record/fixtures.rb:852:in `before_setup'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-rails-3.7.2/lib/rspec/rails/adapters.rb:126:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/example.rb:447:in `instance_exec'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/example.rb:447:in `instance_exec'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/hooks.rb:375:in `execute_with'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/hooks.rb:608:in `block (2 levels) in run_around_example_hooks_for'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/example.rb:342:in `call'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:123:in `block in run'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `loop'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:110:in `run'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-retry-0.6.1/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # /usr/local/lib/ruby/gems/2.3.0/gems/rspec-retry-0.6.1/lib/rspec/retry.rb:37:in `block (2 levels) in setup'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants