SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.95k stars 2.51k forks source link

[🐛 Bug]: Unable start session, status code 500, net::ERR_CONNECTION_REFUSED #1958

Closed ctron closed 8 months ago

ctron commented 1 year ago

What happened?

Starting a new session using:

let caps =  DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:4444", caps).await?;

It fails with:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: an unknown error occurred in the remote end whilst processing the command: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: chrome=117.0.5938.92)', integration-tests/src/ui.rs:111:43

Sniffing the traffic on port 4444 shows a 500 status code on the last message:

HTTP/1.1 500 Internal Server Error
content-length: 1044
content-type: application/json; charset=utf-8
cache-control: no-cache

{"value":{"error":"unknown error","message":"unknown error: net::ERR_CONNECTION_REFUSED\n  (Session info: chrome=117.0.5938.92)","stacktrace":"#0 0x5607dbf1f6b3 \u003Cunknown>\n#1 0x5607dbbf51e7 \u003Cunknown>\n#2 0x5607dbbed2f3 \u003Cunknown>\n#3 0x5607dbbddd17 \u003Cunknown>\n#4 0x5607dbbdf191 \u003Cunknown>\n#5 0x5607dbbde053 \u003Cunknown>\n#6 0x5607dbbdd06c \u003Cunknown>\n#7 0x5607dbbdcfde \u003Cunknown>\n#8 0x5607dbbdbbe4 \u003Cunknown>\n#9 0x5607dbbdc06a \u003Cunknown>\n#10 0x5607dbbf78ce \u003Cunknown>\n#11 0x5607dbc77ad5 \u003Cunknown>\n#12 0x5607dbc5e0c2 \u003Cunknown>\n#13 0x5607dbc77322 \u003Cunknown>\n#14 0x5607dbc5de93 \u003Cunknown>\n#15 0x5607dbc30934 \u003Cunknown>\n#16 0x5607dbc3171e \u003Cunknown>\n#17 0x5607dbee4cb8 \u003Cunknown>\n#18 0x5607dbee8bf0 \u003Cunknown>\n#19 0x5607dbef319c \u003Cunknown>\n#20 0x5607dbee9808 \u003Cunknown>\n#21 0x5607dbeb627f \u003Cunknown>\n#22 0x5607dbf0de88 \u003Cunknown>\n#23 0x5607dbf0e059 \u003Cunknown>\n#24 0x5607dbf1e843 \u003Cunknown>\n#25 0x7fd10832b609 start_thread\n"}}

Command used to start Selenium Grid with Docker

podman run --rm -p 4444:4444 --shm-size="2g" docker.io/selenium/standalone-chrome:117.0

Relevant log output

2023-09-29 15:42:31,133 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2023-09-29 15:42:31,136 INFO RPC interface 'supervisor' initialized
2023-09-29 15:42:31,136 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2023-09-29 15:42:31,136 INFO supervisord started with pid 3
2023-09-29 15:42:32,138 INFO spawned: 'xvfb' with pid 5
2023-09-29 15:42:32,139 INFO spawned: 'vnc' with pid 6
2023-09-29 15:42:32,140 INFO spawned: 'novnc' with pid 7
2023-09-29 15:42:32,142 INFO spawned: 'selenium-standalone' with pid 8
Setting up SE_NODE_GRID_URL...
2023-09-29 15:42:32,150 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2023-09-29 15:42:32,150 INFO success: vnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2023-09-29 15:42:32,150 INFO success: novnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2023-09-29 15:42:32,150 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Selenium Grid Standalone configuration: 
[network]
relax-checks = true

[node]
session-timeout = "300"
override-max-sessions = false
detect-drivers = false
drain-after-session-count = 0
max-sessions = 1

[[node.driver-configuration]]
display-name = "chrome"
stereotype = '{"browserName": "chrome", "browserVersion": "117.0", "platformName": "Linux"}'
max-sessions = 1

Starting Selenium Grid Standalone...
Tracing is disabled
15:42:32.456 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
15:42:32.460 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
15:42:32.866 INFO [NodeOptions.getSessionFactories] - Detected 24 available processors
15:42:32.898 INFO [NodeOptions.report] - Adding chrome for {"browserName": "chrome","browserVersion": "117.0","platformName": "linux","se:noVncPort": 7900,"se:vncEnabled": true} 1 times
15:42:32.910 INFO [Node.<init>] - Binding additional locator mechanisms: relative
15:42:32.922 INFO [GridModel.setAvailability] - Switching Node 1a3f5e75-17cd-4c4f-8864-0a5a43b5d6f9 (uri: http://10.0.2.100:4444) from DOWN to UP
15:42:32.922 INFO [LocalDistributor.add] - Added node 1a3f5e75-17cd-4c4f-8864-0a5a43b5d6f9 at http://10.0.2.100:4444. Health check every 120s
15:42:33.018 INFO [Standalone.execute] - Started Selenium Standalone 4.13.0 (revision ba948ece5b*): http://10.0.2.100:4444
15:42:39.927 INFO [LocalDistributor.newSession] - Session request received by the Distributor: 
 [Capabilities {browserName: chrome, goog:chromeOptions: {w3c: true}, pageLoadStrategy: normal}]
15:42:40.028 WARN [SeleniumManager.lambda$runCommand$1] - Exception managing chrome: Unable to discover proper chromedriver version in offline mode
15:42:40.588 INFO [LocalNode.newSession] - Session created by the Node. Id: 92fc1c3ee2d8d27108c8ca0d9be62ee1, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 117.0.5938.92, chrome: {chromedriverVersion: 117.0.5938.92 (67649b10b92b..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:40085}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://10.0.2.100:4444/sessio..., se:cdpVersion: 117.0.5938.92, se:vnc: ws://10.0.2.100:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://10.0.2.100:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
15:42:40.592 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: 92fc1c3ee2d8d27108c8ca0d9be62ee1 
 Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 117.0.5938.92, chrome: {chromedriverVersion: 117.0.5938.92 (67649b10b92b..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:40085}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://10.0.2.100:4444/sessio..., se:cdpVersion: 117.0.5938.92, se:vnc: ws://10.0.2.100:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://10.0.2.100:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
15:42:40.695 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "ad09a31ceb22a9f5930c173151d9f3ce","eventTime": 1696002160693284247,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "localhost:4444","http.method": "POST","http.request_content_length": "33","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f92fc1c3ee2d8d27108c8ca0d9be62ee1\u002furl"}}

Operating System

Fedora 38

Docker Selenium version (tag)

docker.io/selenium/standalone-chrome:117.0

github-actions[bot] commented 1 year ago

@ctron, 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!

pvdochtend commented 1 year ago

I have found a fix for this problem. It's described here:

https://github.com/bonigarcia/webdrivermanager/issues/1128

ctron commented 1 year ago

I have found a fix for this problem. It's described here:

bonigarcia/webdrivermanager#1128

I am not sure how this release TBH.

ctron commented 1 year ago

What I did notice however was that it's doesn't seem to be related to podman, but also fails on GitHub actions with plain docker.

VietND96 commented 10 months ago

Recently there was a feat #2008 to resolve issues related to status 500. Can you try a newer image tag? (at least 4.15.0-20231122)

VietND96 commented 8 months ago

We closed the ticket with the fixes in build number provided and no more inputs for a long time. Kindly reopen if it occurs again. Thanks!

github-actions[bot] commented 7 months ago

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