-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
C-rbRuby BindingsRuby BindingsI-defectSomething is not working as intendedSomething is not working as intendedR-help wantedIssues looking for contributionsIssues looking for contributions
Description
What happened?
Using selenium-webdriver
4.25.0 or 4.26.0, Ruby 3.2.2 (or 3.3.5), and teaspon
1.4.0, we run into an issue where Webdriver tries to terminate its child process and throws an exception because the process doesn't exist. (see log output)
This is slightly different than, but seemingly related to #14032, in that ErrNo::ERSCH
is thrown, rather than Errno::ECHILD
in #14032.
We are able to work around this by creating a small money patch to override the terminate
method (as an initializer since this is a Rails app):
# config/initializers/selenium_monkey_patch.rb
require 'selenium-webdriver' # Ensure selenium-webdriver is loaded
module Selenium
module WebDriver
class ChildProcess
# Monkey patch the terminate method to rescue from the browser
# process already having been terminated for hashtag reasons.
# Is similar but not exactly the same as the problem described
# in https://github.com/SeleniumHQ/selenium/issues/14032
def terminate(pid)
Process.kill('SIGTERM', pid)
rescue Errno::ECHILD, Errno::ESRCH
# Process is already dead, no action needed
p "MONKEYPATCH: Process is already dead, no action needed"
p "MONKEYPATCH: Don't leave me this way!"
end
end
end
end
How can we reproduce the issue?
Run `bundle exec teaspoon` under Ruby 3.2.2 or Ruby 3.3.5, with `selenium-webdriver` 4.25.0 or 4.26.0
Relevant log output
Teaspoon running default suite at http://127.0.0.1:43075/teaspoon/default
.........................
Finished in 0.03000 seconds
25 examples, 0 failures
bundler: failed to load command: teaspoon (/home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/bin/teaspoon)
/home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/child_process.rb:114:in `kill': No such process (Errno::ESRCH)
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/child_process.rb:114:in `terminate'
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/child_process.rb:68:in `stop'
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/service_manager.rb:110:in `stop_process'
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/service_manager.rb:71:in `stop'
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/service_manager.rb:53:in `block in start'
from /home/runner/work/elements/elements/vendor/bundle/ruby/3.2.0/gems/selenium-webdriver-4.25.0/lib/selenium/webdriver/common/platform.rb:152:in `block in exit_hook'
### Operating System
macOS, Linux
### Selenium version
4.25.0
### What are the browser(s) and version(s) where you see this issue?
Headless chrome, firefox
### What are the browser driver(s) and version(s) where you see this issue?
latest as invoked by selenium-manager
### Are you using Selenium Grid?
n/a
Metadata
Metadata
Assignees
Labels
C-rbRuby BindingsRuby BindingsI-defectSomething is not working as intendedSomething is not working as intendedR-help wantedIssues looking for contributionsIssues looking for contributions