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

[🐛 Bug]: error from remote server causes a secondary error in Ruby library #14415

Closed
jonleighton opened this issue Aug 21, 2024 · 5 comments · Fixed by #14433
Closed

[🐛 Bug]: error from remote server causes a secondary error in Ruby library #14415

jonleighton opened this issue Aug 21, 2024 · 5 comments · Fixed by #14433

Comments

@jonleighton
Copy link

jonleighton commented Aug 21, 2024

What happened?

An error from a remote Selenium server is not correctly reported when using the selenium-webdriver v4.23.0 library in Ruby.

It appears that a bug in the selenium-webdriver exception handling code causes another exception to be raised.

Note that this problem does not occur in the previous v4.22.0 version.

How can we reproduce the issue?

I can reproduce by deliberately creating a situation where the client cannot obtain a new session within the timeout.

In one terminal, start selenium via a Docker container:

docker run \
  --rm \
  -p "4444:4444" \
  --shm-size="2g" \
  -e SE_SESSION_REQUEST_TIMEOUT=1 \
  -e SE_NODE_MAX_SESSIONS=1 \
  selenium/standalone-chromium:latest

In another terminal, run the following Ruby script:

# test.rb

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "selenium-webdriver", "4.23.0"
end

2.times.each do
  options = Selenium::WebDriver::Options.chrome
  driver = Selenium::WebDriver.for :remote, url: "http://localhost:4444/wd/hub", options: options
  driver.navigate.to "http://google.com"
end

Relevant log output

/Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:61:in `set_backtrace': backtrace must be Array of String (TypeError)

          cause.set_backtrace(backtrace)
                              ^^^^^^^^^
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:61:in `add_cause'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:41:in `error'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `new'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `create_response'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:67:in `call'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:675:in `execute'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:76:in `create_session'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:323:in `block in create_bridge'
	from <internal:kernel>:90:in `tap'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:322:in `create_bridge'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/driver.rb:38:in `initialize'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:57:in `new'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:57:in `for'
	from /Users/jon/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver.rb:89:in `for'
	from test.rb:10:in `block in <main>'
	from test.rb:8:in `times'
	from test.rb:8:in `each'
	from test.rb:8:in `<main>'

Operating System

macOS Sonoma

Selenium version

Ruby 4.23.0

What are the browser(s) and version(s) where you see this issue?

Chromium 127.0

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 127.0.6533.119

Are you using Selenium Grid?

No response

Copy link

@jonleighton, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@jonleighton
Copy link
Author

jonleighton commented Aug 21, 2024

#14170 probably introduced this problem. CC-ing those involved: @p0deje @ioquatix @aguspe

@aguspe
Copy link
Contributor

aguspe commented Aug 21, 2024

Thank you so much @jonleighton for raising this, I will pick this up and investigate later today

@aguspe
Copy link
Contributor

aguspe commented Aug 23, 2024

This is my draft PR to fix the issue #14433, I will improve the test later today and put it up for review

Copy link

github-actions bot commented Oct 6, 2024

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants