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]: Getting java.net.ConnectException while running tests that handle two windows #2267

Open
farious2009 opened this issue May 21, 2024 · 7 comments

Comments

@farious2009
Copy link

What happened?

Hi Team,

We do run tests using Java 17 + TestNG (7.10.2)+ Selenium (4.21), Allure using Selenium Grid with Chrome nodes in dind.

The problem happens with tests related to 2 windows handling, e.g. Facebook registration or any other deed where new window pops up after a click and we need to handle 2 windows: e.g. when I click on register Facebook button on our standard registration page an additional window pops up asking for credentials:
facebook

Then entering user’s data and upon clicking on log in I will be redirected back to the initial page of ours and after that test got stuck. It happens really randomly: sometimes after the first cycle of registration or log ins, sometime – after the second circle if test’s logic requires that. Recently playing around with Grids settings I was able to run upon tests’ timeouts already on our page (far away then usual), but the errors are always the same:
Unable to execute request for an existing session: java.net.ConnectException

and does not matter whether it is Windows or Linux, single thread or multi: I tested against all. Always looks and behaves that browser/node become abandoned until the very end of the suite.

That happens completely random, and no one knows which test will become broken (among “2 windows’ ones”) and what is more important that the following tests from the same thread will be broken as domino after the very first one. Also, worth mentioning: the higher version of Chrome more unstable tests/threads are. Currently we do using Chrome node version 115 which is relatively stable, but 122, 124 and 125 are impossible to be used as the results are always unpredicted and we cannot rely on them (A situation is the same for Edge either, though I have not tested against not Chromium based browsers).

Below there is info alongside an example of a suite with 3 threads how I can reproduce an issue locally having Dynamic Grid via docker compose:
suite
I tried different SE_ values: lower or higher, but all are the same:
docker_compose
Toml (it is used without changes: I commented video recording recently as know where tests are failing: also, to test what impact it would be having on results):
toml

Based on my volumes I am able to save 2 (in fact 3, but logs, for some reason, are empty: maybe I am mistaken with volumes somewhere, as permissions are as below):
video
folder

Session capabilities:
session_cap

Allure’s small example:
allure

What is important the used session ID for such test are the same starting from the very first broken test (the one with mentioned broken connection):
test1
test2
test3
You see: IDs are the same, and I have no idea where those 5s timeouts come from (maybe that’s TestNG puts the session till next failing test if a connection suddenly lost with a current test/node and tries to apply to another test: though, it is just my own speculations).
Timeline are from above-mentioned run:
allure_tests

A whole suite to show you how threads are “occupied” by these exceptions and how all next tests fail apart being under the same thread:
whole_suite
Vs good run against Chrome 115 :
allure_110

Here the test failed exactly prior to SwitchTo a parent window (this is a different run than above, so ID is a different), however tests are broken as the behavior as well as an error are the same, and those 5 sec..:
test_switch_to

Regarding the code/steps themselves suing as an example Facebook (but there are others external systems which fall as well): tests are trivial ones:

  • Being on our page click on button (Facebook loging).
  • Once new (child) Facebook window pops up we catch parent and child using ThreadLocal< String >.
  • Then we do use thread's getter and setters alongside getWindowHandle() and getWindowHandles().
  • Then - simple manipulation between windows (like entering data and clicking here and there) using switchTo().window().

That’s pretty much all. Sleeps, wait utils have not helped out at all. I tried to play with Grid settings, but it has not worked out either. We have 16 cores, but even 4 threads fail to be completed; even single thread is not stable; only lowering Node version affects the results.

Below I am attaching logs what I was managed to fetch considering my current settings. If you needed something more to be extracted, would be glad to do so, but I would need you to tell me how exactly to config my current stuff (though, there are no settings for Chrome 115 and it works fine only having SE_EVENT_BUS_HOST and ports being specified with shm_size: 512mb for 13 replicas). But the same does not work for Selenuim Grid nor Dynamic Grid (even with shm_size:2 gb).

What I am seeing in docker logs that those weird warnings with 404 errors requests (I am pretty sure they appear when I enter/click or doing something else on a child window).
And if test fails prior or after (I am not sure here) there are also 500s errors (but maybe that’s expected if you check after the container and session have been removed, I dunno, just speculation as we've run out of options).

The expected behavior

We want to run 1 test against one Chrome node (presumably the latest one: either 124 or 125) and close it once test either completed or failed. And this node should have been our Las Vegas: what happens inside remains there and won’t be affecting another tests nor thread at all even it got stuck: independent multithreading is needed here either.

Best Regards

Command used to start Selenium Grid with Docker (or Kubernetes)

docker compose up -d
docker-compose up -d

Relevant log output

From IDEA:
19:49:39,054 INFO  [DisposablesRegistry] - Run cleanup: size=1
19:49:39,055 INFO  [CloseDriverCommand] - Close webdriver: 44 -> RemoteWebDriver: chrome on linux (6d5df209963c352e6e73b78485ac4e9e)...
19:49:39,062 INFO  [DeadThreadsWatchdog] - Thread 28 is dead. Let's close its webdriver RemoteWebDriver: chrome on linux (6d5df209963c352e6e73b78485ac4e9e).
19:49:39,062 INFO  [CloseDriverCommand] - Close webdriver: 45 -> RemoteWebDriver: chrome on linux (6d5df209963c352e6e73b78485ac4e9e)...
19:49:45,548 ERROR [CloseDriverCommand] - Cannot close browser: WebDriverException: Unable to execute request for an existing session: java.net.ConnectException
19:49:45,548 INFO  [CloseDriverCommand] - Closed webdriver 44 in 6493 ms
19:49:45,548 INFO  [DisposablesRegistry] - Finished cleanup
19:49:45,548 ERROR [CloseDriverCommand] - Cannot close browser: WebDriverException: Unable to execute request for an existing session: java.net.ConnectException
19:49:45,548 INFO  [CloseDriverCommand] - Closed webdriver 45 in 6486 ms
19:49:45,548 INFO  [DisposablesRegistry] - Unregister WebDriverInstance[config=StaticConfig, webDriver=RemoteWebDriver: chrome on linux (null), proxy=null, downloadsFolder=null] in 45 [size=0]
19:49:45,548 INFO  [DeadThreadsWatchdog] - No webdriver found for thread: 30 - nothing to close
19:49:45,548 INFO  [DeadThreadsWatchdog] - No webdriver found for thread: 29 - nothing to close
19:49:45,548 INFO  [DeadThreadsWatchdog] - No webdriver found for thread: 28 - nothing to close

Process finished with exit code 0

org.openqa.selenium.WebDriverException: Unable to execute request for an existing session: java.net.ConnectException
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.10'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [6d5df209963c352e6e73b78485ac4e9e, screenshot {}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 125.0.6422.60, chrome: {chromedriverVersion: 125.0.6422.60 (3ac3319bff9f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:33143}, goog:loggingPrefs: {browser: ALL, performance: ALL}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.32.3:4444/sess..., se:cdpVersion: 125.0.6422.60, se:forwardCdp: ws://192.168.32.4:4444/sess..., se:recordVideo: true, se:vnc: ws://192.168.32.3:4444/sess..., se:vncEnabled: true, se:vncLocalAddress: ws://192.168.32.4:7900, selenoid:options: {enableVNC: true, enableVideo: true}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: accept, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 6d5df209963c352e6e73b78485ac4e9e



Docker’s errors:
dynamic_grid-node-docker-1: 17:49:28.996 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "f37308671b0afb691c63c3576e5afc9f","eventTime": 1716313768996533141,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "593","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.040 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "8873816d390cdccb4737021672274c98","eventTime": 1716313769039708576,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7174","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.062 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "e98c0cf0df91abd6e9d0940e8de16548","eventTime": 1716313769062027523,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7177","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.139 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "f37ea9cf272edd824129da509cb1025f","eventTime": 1716313769138966810,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7177","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.218 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "0eb5dd2d6bcec2b2c8c6d57754315f01","eventTime": 1716313769218121759,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7173","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.281 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "557245f141ddd28d5cf5188bcf09b749","eventTime": 1716313769281160218,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7171","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.352 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "4761c3eb96991b5252e5f02c9684ed57","eventTime": 1716313769352534610,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7173","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.429 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "62e592c1f8dc55604144e985e9db01e6","eventTime": 1716313769428820190,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7176","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.510 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "31bfd215e747521deb81f47ddcd96b0f","eventTime": 1716313769510702337,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7177","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.582 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "a0b399cce9d9dd6e0539960f23f190df","eventTime": 1716313769582629556,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7180","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.679 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "7b2a7d7b6b5cca0a9d53f4dbf2adeb70","eventTime": 1716313769679053045,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7173","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.740 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "93baaba6c526390c18510b5a4b656253","eventTime": 1716313769740654872,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "7174","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.763 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "e647ec68147b38848da57ac12a4e9bd3","eventTime": 1716313769763178802,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "GET","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002felement\u002ff.0D58F2F43843BFAA41CCFF15AE349AD1.d.C35A14FCE03000C180ED2677258091AF.e.40\u002fselected","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.841 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "5e47bf457b272eb94e5b78d3531761c0","eventTime": 1716313769841794081,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "19530","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fexecute\u002fsync","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.864 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "d1b9fe2a7ec775fafff3401d3530aeb4","eventTime": 1716313769864412932,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "GET","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002felement\u002ff.0D58F2F43843BFAA41CCFF15AE349AD1.d.C35A14FCE03000C180ED2677258091AF.e.40\u002ftext","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:29.881 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "ca2e5b762c6f30662c349da628c2895f","eventTime": 1716313769881207341,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "GET","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002felement\u002ff.0D58F2F43843BFAA41CCFF15AE349AD1.d.C35A14FCE03000C180ED2677258091AF.e.40\u002fname","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:38.940 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "01640463d8fba0efd7d90524c09f3f72","eventTime": 1716313778940108478,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "GET","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fwindow\u002fhandles","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:39.002 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "c3b584d745e355fd9cb470eb48bad72f","eventTime": 1716313779001811130,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "POST","http.request_content_length": "50","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fwindow","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:39.017 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "a01cd6b46971a0594ea3be5fed5d90d1","eventTime": 1716313779017258051,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "GET","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e\u002fscreenshot","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:39.072 INFO [Container.stop] - Stopping container b9a9d143aaceabd82b77d231573270be477c48c68ef07c2f3bd435667c0835a7
dynamic_grid-node-docker-1: 17:49:39.093 INFO [Container.stop] - Stopping container b9a9d143aaceabd82b77d231573270be477c48c68ef07c2f3bd435667c0835a7
dynamic_grid-node-docker-1: 17:49:40.871 INFO [Container.getLogs] - Getting logs d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:40.871 INFO [V141Docker.getContainerLogs] - Getting container logs: d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:40.871 INFO [Container.getLogs] - Getting logs d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:40.871 INFO [V141Docker.getContainerLogs] - Getting container logs: d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:40.884 INFO [Container.stop] - Stopping container d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:40.885 INFO [Container.stop] - Stopping container d8acb5f8e6483049d1a62154f734d574cc0840b449495483b87b5191dce1e0ad
dynamic_grid-node-docker-1: 17:49:45.544 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "d49a471ea7899a76dd9440212059f5ca","eventTime": 1716313785543750066,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "DELETE","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
dynamic_grid-node-docker-1: 17:49:45.544 INFO [SessionSlot.stop] - Stopping session 6d5df209963c352e6e73b78485ac4e9e
dynamic_grid-node-docker-1: 17:49:45.545 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "f65581986ec148668a512d5befa61af8","eventTime": 1716313785544723559,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.32.3:5555","http.method": "DELETE","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f6d5df209963c352e6e73b78485ac4e9e","http.user_agent": "selenium\u002f4.21.0 (java windows)"}}
dynamic_grid-node-docker-1: 
selenium-hub: 17:49:45.545 INFO [GridModel.release] - Releasing slot for session id 6d5df209963c352e6e73b78485ac4e9e
selenium-hub: 17:49:45.546 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local Session Map, Id: 6d5df209963c352e6e73b78485ac4e9e

___
Container log (different run):
024-05-21 23:06:29,125 INFO Included extra file "/etc/supervisor/conf.d/chrome-cleanup.conf" during parsing
2024-05-21T23:06:29.126474366Z 2024-05-21 23:06:29,126 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2024-05-21T23:06:29.132728899Z 2024-05-21 23:06:29,132 INFO RPC interface 'supervisor' initialized
2024-05-21T23:06:29.132756700Z 2024-05-21 23:06:29,132 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-05-21T23:06:29.133880668Z 2024-05-21 23:06:29,133 INFO supervisord started with pid 7
2024-05-21T23:06:30.140522632Z 2024-05-21 23:06:30,139 INFO spawned: 'xvfb' with pid 8
2024-05-21T23:06:30.145959276Z 2024-05-21 23:06:30,145 INFO spawned: 'vnc' with pid 9
2024-05-21T23:06:30.151436577Z 2024-05-21 23:06:30,150 INFO spawned: 'novnc' with pid 12
2024-05-21T23:06:30.158657391Z 2024-05-21 23:06:30,157 INFO spawned: 'selenium-standalone' with pid 17
2024-05-21T23:06:30.163144572Z 2024-05-21 23:06:30,162 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-05-21T23:06:30.163166977Z 2024-05-21 23:06:30,162 INFO success: vnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-05-21T23:06:30.163170350Z 2024-05-21 23:06:30,162 INFO success: novnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-05-21T23:06:30.163172792Z 2024-05-21 23:06:30,162 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-05-21T23:06:30.558312486Z Appending Selenium options: --heartbeat-period 30
2024-05-21T23:06:30.558339439Z Appending Selenium options: --reject-unsupported-caps false
2024-05-21T23:06:30.561478749Z Setting up SE_NODE_GRID_URL...
2024-05-21T23:06:30.567497620Z Selenium Grid Standalone configuration: 
2024-05-21T23:06:30.568120350Z [network]
2024-05-21T23:06:30.568129012Z relax-checks = true
2024-05-21T23:06:30.568130618Z 
2024-05-21T23:06:30.568131812Z [node]
2024-05-21T23:06:30.568132993Z session-timeout = "300"
2024-05-21T23:06:30.568134389Z override-max-sessions = false
2024-05-21T23:06:30.568135595Z detect-drivers = false
2024-05-21T23:06:30.568136772Z drain-after-session-count = 0
2024-05-21T23:06:30.568138031Z max-sessions = 1
2024-05-21T23:06:30.568146142Z 
2024-05-21T23:06:30.568147742Z [[node.driver-configuration]]
2024-05-21T23:06:30.568148975Z display-name = "chrome"
2024-05-21T23:06:30.568150324Z stereotype = '{"browserName": "chrome", "browserVersion": "125.0", "platformName": "Linux", "goog:chromeOptions": {"binary": "/usr/bin/google-chrome"}}'
2024-05-21T23:06:30.568152193Z max-sessions = 1
2024-05-21T23:06:30.568153429Z 
2024-05-21T23:06:30.568283214Z Starting Selenium Grid Standalone...
2024-05-21T23:06:30.568443385Z Tracing is disabled
2024-05-21T23:06:30.924989407Z 23:06:30.921 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
2024-05-21T23:06:30.927633718Z 23:06:30.926 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
2024-05-21T23:06:31.401843878Z 23:06:31.400 INFO [NodeOptions.getSessionFactories] - Detected 12 available processors
2024-05-21T23:06:31.445730236Z 23:06:31.445 INFO [NodeOptions.report] - Adding chrome for {"browserName": "chrome","browserVersion": "125.0","goog:chromeOptions": {"binary": "\u002fusr\u002fbin\u002fgoogle-chrome"},"platformName": "linux","se:noVncPort": 7900,"se:vncEnabled": true} 1 times
2024-05-21T23:06:31.467260065Z 23:06:31.466 INFO [Node.<init>] - Binding additional locator mechanisms: relative
2024-05-21T23:06:31.483909164Z 23:06:31.483 INFO [GridModel.setAvailability] - Switching Node ccb1cce0-6c4b-4207-9eb9-0cad4a199cea (uri: http://192.168.32.4:4444) from DOWN to UP
2024-05-21T23:06:31.484103072Z 23:06:31.483 INFO [LocalDistributor.add] - Added node ccb1cce0-6c4b-4207-9eb9-0cad4a199cea at http://192.168.32.4:4444. Health check every 10s
2024-05-21T23:06:31.612694178Z 23:06:31.611 INFO [Standalone.execute] - Started Selenium Standalone 4.21.0 (revision 79ed462ef4): http://192.168.32.4:4444
2024-05-21T23:06:31.956680135Z 23:06:31.956 INFO [LocalDistributor.newSession] - Session request received by the Distributor: 
2024-05-21T23:06:31.956704421Z  [Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--proxy-bypass-list=<-loopb..., --disable-dev-shm-usage, --window-size=1366,768, --no-sandbox, --disable-xss-auditor, --disable-infobars, --remote-allow-origins=*], excludeSwitches: [enable-automation, load-extension], extensions: [], prefs: {credentials_enable_service: false, profile.managed_default_content_settings.notifications: 2, profile.password_manager_enabled: false}}, goog:loggingPrefs: {browser: ALL, performance: ALL}, pageLoadStrategy: normal, se:recordVideo: true, selenoid:options: {enableVNC: false, enableVideo: false}, unhandledPromptBehavior: accept}]
2024-05-21T23:06:33.073140190Z 23:06:33.072 INFO [LocalNode.newSession] - Session created by the Node. Id: f39de9581318946d265bfa07163a2d74, Caps: Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 125.0.6422.60, chrome: {chromedriverVersion: 125.0.6422.60 (3ac3319bff9f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:41529}, goog:loggingPrefs: {browser: ALL, performance: ALL}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.32.4:4444/sess..., se:cdpVersion: 125.0.6422.60, se:recordVideo: true, se:vnc: ws://192.168.32.4:4444/sess..., se:vncEnabled: true, se:vncLocalAddress: ws://192.168.32.4:7900, selenoid:options: {enableVNC: false, enableVideo: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: accept, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
2024-05-21T23:06:33.077255541Z 23:06:33.076 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: f39de9581318946d265bfa07163a2d74 
2024-05-21T23:06:33.077305328Z  Caps: Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 125.0.6422.60, chrome: {chromedriverVersion: 125.0.6422.60 (3ac3319bff9f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:41529}, goog:loggingPrefs: {browser: ALL, performance: ALL}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.32.4:4444/sess..., se:cdpVersion: 125.0.6422.60, se:recordVideo: true, se:vnc: ws://192.168.32.4:4444/sess..., se:vncEnabled: true, se:vncLocalAddress: ws://192.168.32.4:7900, selenoid:options: {enableVNC: false, enableVideo: false}, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: accept, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

Operating System

Windows 10 (local run), Linux (job's run)

Docker Selenium version (image tag)

selenium/node-docker 4.21.0-20240517

Selenium Grid chart version (chart version)

No response

Copy link

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

@farious2009
Copy link
Author

farious2009 commented May 21, 2024

In addition:
Using not Dynamic Grid does not work either with a current config:
replicas

@farious2009 farious2009 changed the title [🐛 Bug]: Getting java.net.ConnectException while running tests that handles two windows [🐛 Bug]: Getting java.net.ConnectException while running tests that handle two windows May 21, 2024
@diemol
Copy link
Member

diemol commented May 22, 2024

I am failing to see how we can help. I do not see an apparent bug related to the Selenium Grid, but rather a combination of elements that could be the reason for your issues.

One crucial fact is that you are involving a 3rd party in your tests that you do not have control over. Facebook might be working well, and your tests work, but if, for some reason, a request does not work, you have zero control there.

Thank you for taking the time to explain your situation, but I am sorry, I do not know what should be done on our side.

@farious2009
Copy link
Author

farious2009 commented May 22, 2024

2 things that make me worried about here:

  1. All works fine with Chrome 115 no matter how many tests and threads we use (and without any additional settings). But once Chrome is higher, then all starts breaking apart. Also, not with RemoteDriver run also works completely fine against any version locally installed browser (with chromedriver). So, we could catch this issue only running remotely+ > 115.
  2. What do you think can be done to prevent next tests failing under the same thread (with the same session ID)? Could we kill node even if there theoretically was no connection or suddenly it would be lost, because it is hard to said that we do have isolated test (however again, this does not happen with Chrome 115).

This is local run (have just kicked off 2 runs to show):
local_run
vs
remote one:
tempsnip
tempsnip1

Tests are the same, all the same, but behaving completely differently.

Thanks in advance!

@diemol
Copy link
Member

diemol commented May 22, 2024

You can track the issues for Chrome and ChromeDriver at https://bugs.chromium.org/p/chromedriver, and try to find something that explains your problem.

Regarding the second question, I would like to say again that I do not know. Please note that this is an issue tracker, and we can act on reported issues that can be reproduced, especially in some cases where the log is clear enough to demonstrate the bug.

I understand you are trying to figure out what is going on, but we cannot help you if we cannot easily reproduce the issue.

@farious2009
Copy link
Author

Will try to check/find anything related or similar.
Thanks for swift responses.

@farious2009
Copy link
Author

This case could be closed up probably as you had said you would can do nothing here. But before that yet to happen may I ask you simple two questions (I hope so):

  1. Maybe I am blind but how to increase that number of concurrent dynamic nodes from default 12 one to... let's say 20?
    12
  2. What would you recommend for the big environment: usage of dynamic grid or a regular one (where we use strictly defined numbers of replicas) considering the rest of settings are the same. I tend to think that dynamic one is more efficient (though, have not done any tests yet), but maybe you could advise.

Thanks in advance!

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

No branches or pull requests

2 participants