When upgrading rspec and rspec-rails from 3.6.0 resp. 3.6.1 to 3.7.0 resp. 3.7.1, my tests fail in a loop, with the following stacktrace:
Error in reactor loop escaped: Invalid argument (Errno::EINVAL)
/Users/xxx/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/reactor.rb:29:in `select'
/Users/xxx/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/reactor.rb:29:in `run_internal'
/Users/xxx/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/puma-3.10.0/lib/puma/reactor.rb:154:in `block in run_in_thread'
Downgrading Puma does not resolve the issue. Note, I also use capybara 2.13.0 and capybara-webkit 1.14.0.
@alexbuijs
Thanks for the issue. We need a little more detail to be able to reproduce this.
Could you please provide us with a rails app that we can clone that demonstrates the issue. Specifically it'd be great if
1) you could rails new an application and commit
2) make all the changes necessary to reproduce the issue and commit
then, provide us with a description of how to clone your application and reproduce the issue.
Thanks :)
This is probably related to our system test integration, try setting Capybara.server = :webbrick as a work around until we resolve the teething troubles we've been having.
you mean Capybara.server = :webrick with only one 'b' I guess ?
puma/puma#1582 seems related. TL;DR: Using Timecop can cause Puma to sleep for too long, causing an error.
I am also getting this on 3.11.4. We are using Timecop.
So far I have noticed that the error occurs if Timecop.freeze is called after puma has already been started by capybara.
I'm running into the same issue with selenium_chrome_headless and replacing Timecop with ActiveSupport time helpers. Replacing puma with webrick fixed it for me, but it'd be better if that weren't necessary.
This looks very similar. I don't know how to get more helpful background info on how to reproduce the problem. Please let me know how I can help.
capybara (3.9.0)
capybara-selenium (0.0.6)
chromedriver-helper (2.1.0)
rspec (3.8.0)
rspec-core (3.8.0)
rspec-expectations (3.8.2)
rspec-instafail (1.0.0)
rspec-mocks (3.8.0)
rspec-rails (3.8.0)
rspec-support (3.8.0)
puma (3.12.0)
Error in reactor loop escaped: Invalid argument (Errno::EINVAL)
ruby-2.3.7@clear_value_plus/gems/puma-3.12.0/lib/puma/reactor.rb:126:in 'select'
ruby-2.3.7@clear_value_plus/gems/puma-3.12.0/lib/puma/reactor.rb:126:in 'run_internal'
ruby-2.3.7@clear_value_plus/gems/puma-3.12.0/lib/puma/reactor.rb:251:in 'block in run_in_thread'
We need an actual part of a backtrace containing something thats not puma, normally this would be as simple as passing --backtrace but I don't know wether that gets passed to puma.
I strongly doubt this issue has anything to do with RSpec, which is why I linked puma/puma#1582 earlier. I think this is likely a time travel (Timecop and/or ActiveSupport's TimeHelpers) + Puma issue.
Either way a more detailed backtrace is the start to reproducing whats going on here :)
After some investigations, in our case these errors are happening only when dates are stubbed to future date. When stubbed to past date there is no errors (guess because delta is negative 馃槃 ), so..... just refactored everything to past.
Closing as stale for now, if there is any interest in this let us know and we will reopen.
Same if you could provide a reproduction case that involves rspec-rails. 馃槉
I have managed to fix it by https://gist.github.com/2rba/74d57775ac83ffcb0ff1da5eb5371212
I am interested. I have downgraded capybara to v2.18.0 in our software to work around this problem.
@mileslane Did you try @2rba's patch?
@benoittgt, I tested it tonight.
I am no longer seeing this error: "Invalid argument (Errno::EINVAL)" and I don't see errors with puma in the stack trace. I am seeing some timeout errors.
For example:
Failure/Error: save_screenshot!(example, respond_to?(:page) && current_url.present? && page) if save_screenshot?(example)
Net::ReadTimeout: Net::ReadTimeout # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/aws-sdk-core-3.30.0/lib/seahorse/client/net_http/patches.rb:31:in `block in new_transport_request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/aws-sdk-core-3.30.0/lib/seahorse/client/net_http/patches.rb:28:in `catch' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/aws-sdk-core-3.30.0/lib/seahorse/client/net_http/patches.rb:28:in `new_transport_request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/webmock-3.4.2/lib/webmock/http_lib_adapters/net_http.rb:97:in `block in request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/webmock-3.4.2/lib/webmock/http_lib_adapters/net_http.rb:110:in `block in request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/webmock-3.4.2/lib/webmock/http_lib_adapters/net_http.rb:109:in `request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/default.rb:121:in `response_for' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/default.rb:76:in `request' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/http/common.rb:62:in `call' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:164:in `execute' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:97:in `create_session' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/remote/bridge.rb:53:in `handshake' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/chrome/driver.rb:48:in `initialize' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/common/driver.rb:44:in `new' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver/common/driver.rb:44:in `for' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/selenium-webdriver-3.14.1/lib/selenium/webdriver.rb:86:in `for' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/capybara-3.12.0/lib/capybara/selenium/driver.rb:30:in `browser' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/capybara-3.12.0/lib/capybara/selenium/driver.rb:73:in `current_url' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/capybara-3.12.0/lib/capybara/session.rb:216:in `current_url' # /Users/mileslane/.rvm/gems/ruby-2.3.7@clear_value_plus/gems/capybara-3.12.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' # ./spec/spec_helper.rb:152:in `block (2 levels) in <top (required)>'
So, it looks like perhaps the patch is working? :-)
Closing as stale for now, if there is any interest in this let us know and we will reopen.
Same if you could provide a reproduction case that involves rspec-rails. 馃槉
Please reopen this and apply the patch. I am getting this problem with a project:
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:128:in `select'
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:128:in `run_internal'
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:253:in `block in run_in_thread'
Error in reactor loop escaped: Invalid argument (Errno::EINVAL)
Gemfile includes:
Using capybara 3.15.0
Using puma 3.12.1
Using rspec-core 3.8.0
Using timecop 0.9.1
package.json includes:
"ember-ajax": "4.0.2",
"ember-cli": "<3.5.0",
"ember-cli-emblem": "0.12.0",
"ember-cli-qunit": "4.4.0",
"ember-cli-rails-addon": "0.10.0",
"ember-cli-sass": "7.2.0",
"ember-qunit": "4.4.1",
"qunit": "2.9.2"
@benoittgt - Please reactivate this issue.
I cannot determine whether this is the _correct_ fix, but it does prevent this showing up thousands of times in our test output:
Error in reactor loop escaped: Invalid argument (Errno::EINVAL)
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:128:in `select'
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:128:in `run_internal'
.rvm/gems/ruby-2.5.3/gems/puma-3.12.1/lib/puma/reactor.rb:253:in `block in run_in_thread'
Hi @mileslane that patch is for Puma, I suggest asking them if they would welcome it for inclusion. There is nothing for RSpec to do at this time.
Most helpful comment
I am also getting this on 3.11.4. We are using Timecop.
So far I have noticed that the error occurs if
Timecop.freezeis called after puma has already been started by capybara.