-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
What happened?
Recently we upgraded our Jenkins to the latest version and most of our (Java based) Selenium tests started failing in their pipelines, SessionNotCreatedException caused by a timeout in org.openqa.selenium.remote.http.AddSeleniumUserAgent.
Upon further investigation we found that the following combination of circumstances causes consistent failure:
- Use chromium 128 / chromedriver 128
- Use the new headless mode as
--headless=new - Run from a docker container
I've browsed the issues here to check if it's been reported before and it looks similar to this issue, might be the same cause.
For now our workaround is to downgrade the chromium / chromedriver version our Jenkins runs with. We could also switch our tests to --headless=old but I see that as a fix of last resort. I'd much rather Selenium and new chromedriver versions work together out of the box, even in new headless mode.
How can we reproduce the issue?
See this repository for a minimal reproducing example. For instructions on how to reproduce the issue please see the readme.
Relevant log output
> Task :test
SeleniumTest > headlessNew() FAILED
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: '83b1fb817f96', ip: '172.17.0.1'
at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at app//org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:234)
at app//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
at app//org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
at app//org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
at app//org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
at app//org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
at app//SeleniumTest.createChromeDriver(SeleniumTest.java:26)
at app//SeleniumTest.headlessNew(SeleniumTest.java:9)
Caused by:
org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.23.0', revision: '4df0a231af'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.0-18-amd64', java.version: '21.0.4'
Driver info: driver.version: ChromeDriver
at app//org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute0(JdkHttpClient.java:399)
at app//org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
at app//org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
at app//org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:355)
at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:89)
at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
at app//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:162)
at app//org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
at app//org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 8 more
Caused by:
java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute0(JdkHttpClient.java:382)
... 18 more
SeleniumTest > headlessOld() STANDARD_ERROR
Aug 29, 2024 12:25:03 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 128, returning the closest version; found: 127; Please update to a Selenium version that supports CDP version 128
Gradle Test Executor 1 finished executing tests.Operating System
Alpine 3.20, Debian 12
Selenium version
4.19.1, 4.23
What are the browser(s) and version(s) where you see this issue?
Chrome 128
What are the browser driver(s) and version(s) where you see this issue?
Chromedriver 128
Are you using Selenium Grid?
No