SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.71k stars 8.19k forks source link

[🐛 Bug]: Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. #13562

Closed feller-kristina closed 8 months ago

feller-kristina commented 9 months ago

What happened?

What can be the cause?

I run tests in parallel in Selenium Grid. Time to time I see two errors, one is Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.util.concurrent.TimeoutException and another is Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Note: this errors are only for tests that run in parallel, I use TestNG and configuration is <suite name="Test Suite" parallel="classes" thread-count="3" configfailurepolicy="continue">.

How can we reproduce the issue?

[server]
Config for [node]
hub = "http://ADDRESS"
selenium-manager = true
detect-drivers = true 
max-sessions = 1 
session-timeout = 60
register-cycle = 30 
register-period = 600 
heartbeat-period = 60 
driver-implementation = ["chrome", "firefox","edge"]

Relevant log output

In the first case the node is assigned and session is created, but test is skipped with Response code 500. The HUB log output is 

WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: disconnected: Unable to receive message from renderer
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=121.0.6167.140)
Host info: host: 'SELENIUM-01', ip: '10.100.100.100'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.15.1'
Driver info: driver.version: unknown
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.15.1'
Driver info: driver.version: unknown
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
    at org.openqa.selenium.grid.node.remote.RemoteNode.newSession(RemoteNode.java:152)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:651)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:570)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:830)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:790)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

{"class": "SeleniumSpanExporter$1","log-level": "WARNING","log-message": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: disconnected: Unable to receive message from renderer\n  (failed to check if window was closed: disconnected: not connected to DevTools)\n  (Session info: chrome=121.0.6167.140) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.15.1'\nDriver info: driver.version: unknown\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.15.1'\nDriver info: driver.version: unknown\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: [os.name](http://os.name/): 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.grid.node.remote.RemoteNode.newSession(RemoteNode.java:152)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:651)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:570)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:830)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:790)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\r\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:834)\r\n","log-name": "org.openqa.selenium.remote.tracing.opentelemetry.SeleniumSpanExporter","log-time-local": "2024-02-05T12:53:36.76-07:00","log-time-utc": "2024-02-05T19:53:36.76Z","method": "lambda$export$1"}

Node is not assigned and there is no log in HUB for error Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.



### Operating System

'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'

### Selenium version

'4.17.0', revision: 'e52b1be057*'

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

Chrome

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

Chrome 121.0.6167.140

### Are you using Selenium Grid?

4.17
github-actions[bot] commented 9 months ago

@feller-kristina, 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!

github-actions[bot] commented 9 months ago

Hi, @feller-kristina. Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

feller-kristina commented 9 months ago

Hi, @feller-kristina. Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

The session starts with this code:

protected WebDriver newBrowserInstance(HostType hostType, BrowserType browser, String sessionName) {
        try {
            switch (hostType) {
                case GRID:
                    driverOptions.setCapability(CapabilityType.BROWSER_NAME, browser);
                    driverOptions.setCapability(CapabilityType.PLATFORM_NAME, "ANY");
                    driverOptions.setCapability("se:name", sessionName);
                    int timeOutInMin = getConfig().getDriverCommandExecutorTimeout();
                    ClientConfig config = ClientConfig.defaultConfig().connectionTimeout(Duration.ofMinutes(timeOutInMin))
                            .readTimeout(Duration.ofMinutes(timeOutInMin)).baseUrl(getGridURL());
                    CommandExecutor executor = new HttpCommandExecutor(config);
                    RemoteWebDriver remoteWebDriver =
                            new RemoteWebDriver(executor, driverOptions);

                    remoteWebDriver.setFileDetector(new LocalFileDetector());
                    return remoteWebDriver;
            }
        } catch (Exception ex) {
            throw new RuntimeException("Failed to create WebDriver instance for browser " + browser +
                    " and hostType " + hostType, ex);
        }
    }
pujagani commented 8 months ago

Is this still happening in 4.18.1? If so, please provide a way to reproduce the issue. Refer to https://github.com/SeleniumHQ/selenium/issues/13562#issuecomment-1933077243

feller-kristina commented 8 months ago

We didn't update to 4.18 yet. Once Selenium is updated, I will provide details.

MohnishPophale commented 8 months ago

Is this still happening in 4.18.1? If so, please provide a way to reproduce the issue. Refer to #13562 (comment)

For me this issue is observed in v4.18.1. Also, it was observed only on the Jenkins build when the build execution time was more than 15 minutes (irrespective of serial or parallel builds).

However, I was able to find a work-around this issue. System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-26-amd64', java.version: '21.0.2' Build System Gradle 8.6 Selenium (also grid) version '4.18.1' What are the browser(s) and version(s) where you see this issue? Chrome 122.0.6261.69 (64-bit)

It started failing after there was a major upgrade to more than 20 dependencies I use in my project. After going through a lot of trial and errors, I was able to identify the following dependencies to be problematic (also added the version that now works):

io.cucumber:cucumber-java:7.15.0 (switched to 7.14.0)
io.cucumber:cucumber-junit:7.15.0 (switched to 7.14.0)
io.cucumber:cucumber-spring:7.15.0 (switched to 7.14.0)
org.seleniumhq.selenium:selenium-java:4.18.1 (switched to 4.13.0)
org.apache.logging.log4j:log4j-api:2.23.0 (switched to 2.20.0)
org.apache.logging.log4j:log4j-core:2.23.0 (switched to 2.20.0)
org.apache.logging.log4j:log4j-slf4j-impl:2.23.0 (switched to 2.20.0)
org.apache.logging.log4j:log4j-jul:2.23.0 (switched to 2.20.0)
io.rest-assured:rest-assured:5.4.0 (switched to 5.3.0)
org.jetbrains:annotations:24.1.0 (switched to 24.0.1)
org.json:json:20240303 (switched to 20230227)
io.appium:java-client:9.1.0 (switched to 8.5.1)

Also, my project uses com.browserstack:browserstack-java-sdk:1.11.0 which is pinned to this version because any other version causes issues with my test environment.

diemol commented 8 months ago

@Okbede123 do you have a way to reproduce the issue?

feller-kristina commented 8 months ago

I see the same error with Selenium 4.18.1

I don't have steps to reproduce it, I cannot reproduce it manually. It happens randomly on different nodes. Tests are run with parallel="methods" and parallel="classes", with headless=true. I tried to run tests with headless=false, it didn't help.

Log output:

2024-03-07-20:01:28 WARN [DriverServiceSessionFactory.apply] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Host info: host: 'SELENIUM-01', ip: '10.100.100.100'
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
{"class": "DriverServiceSessionFactory","log-level": "WARNING","log-message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\n  (session not created: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown","log-name": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","log-time-local": "2024-03-07T20:01:28.468-07:00","log-time-utc": "2024-03-08T03:01:28.468Z","method": "apply"}
2024-03-07-20:01:28 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Host info: host: 'SELENIUM-01', ip: '10.100.100.100'
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)
    at org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)
    at org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)
    at org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)
    at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)
    at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.grid.node.Node.execute(Node.java:262)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

{"class": "SeleniumSpanExporter$1","log-level": "WARNING","log-message": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\n  (session not created: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)\r\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)\r\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)\r\n\tat org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)\r\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)\r\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:262)\r\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\r\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\r\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\r\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\r\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:834)\r\n","log-name": "org.openqa.selenium.remote.tracing.opentelemetry.SeleniumSpanExporter","log-time-local": "2024-03-07T20:01:28.499-07:00","log-time-utc": "2024-03-08T03:01:28.499Z","method": "lambda$export$1"}
2024-03-07-20:01:28 WARN [SeleniumSpanExporter$1.lambda$export$1] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Host info: host: 'SELENIUM-01', ip: '10.100.100.100'
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
{"class": "SeleniumSpanExporter$1","log-level": "WARNING","log-message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\n  (session not created: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown","log-name": "org.openqa.selenium.remote.tracing.opentelemetry.SeleniumSpanExporter","log-time-local": "2024-03-07T20:01:28.499-07:00","log-time-utc": "2024-03-08T03:01:28.499Z","method": "lambda$export$1"}
2024-03-07-20:01:28 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "3ef65f90414049386404f5230796c42b","eventTime": 1709866888473796900,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:4942","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\n  (session not created: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\n  (session not created: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)\r\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)\r\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)\r\n\tat org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)\r\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)\r\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:262)\r\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\r\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\r\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\r\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\r\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\r\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\r\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\r\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\r\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\r\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:834)\r\n","exception.type": "org.openqa.selenium.SessionNotCreatedException","logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","session.capabilities": "{\"LT:Options\": {\"selenium_version\": \"4.17.0\",\"build\": \"Sanity (run on 2024-03-07 07:01:26 PM)\",\"name\": \"com.test.:"seCdp\": true},\"acceptInsecureCerts\": true,\"browserName\": \"chrome\",\"goog:chromeOptions\": {\"args\": [\"--start-maximized\",\"--headless=new\"],\"extensions\": []},\"goog:loggingPrefs\": {\"browser\": \"INFO\"},\"platformName\": \"Windows 10\",\"se:name\": \"xml suite name: Sanity | xml test name: Sanity | test class: com.test.Test | test method: test_Verify\",\"unhandledPromptBehavior\": \"accept\"}\n"}}

{"class": "SeleniumSpanExporter$1","log-level": "WARNING","log-message": "{\"traceId\": \"3ef65f90414049386404f5230796c42b\",\"eventTime\": 1709866888473796900,\"eventName\": \"exception\",\"attributes\": {\"driver.url\": \"http:\\u002f\\u002flocalhost:4942\",\"exception.message\": \"Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\\n  (session not created: DevToolsActivePort file doesn't exist)\\n  (The process started from chrome location C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \\nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\\nDriver info: driver.version: unknown\",\"exception.stacktrace\": \"org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.\\n  (session not created: DevToolsActivePort file doesn't exist)\\n  (The process started from chrome location C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \\nHost info: host: 'SELENIUM-01', ip: '10.100.100.100'\\nBuild info: version: '4.18.1', revision: 'b1d3319b48'\\nSystem info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\\nDriver info: driver.version: unknown\\r\\n\\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)\\r\\n\\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)\\r\\n\\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)\\r\\n\\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)\\r\\n\\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)\\r\\n\\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)\\r\\n\\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)\\r\\n\\tat org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)\\r\\n\\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\\r\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\\r\\n\\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)\\r\\n\\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)\\r\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\\r\\n\\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\\r\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\\r\\n\\tat org.openqa.selenium.grid.node.Node.execute(Node.java:262)\\r\\n\\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)\\r\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\\r\\n\\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\\r\\n\\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\\r\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\\r\\n\\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\\r\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\\r\\n\\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\\r\\n\\tat java.base\\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\\r\\n\\tat java.base\\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\\r\\n\\tat java.base\\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\\r\\n\\tat java.base\\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\\r\\n\\tat java.base\\u002fjava.lang.Thread.run(Thread.java:834)\\r\\n\",\"exception.type\": \"org.openqa.selenium.SessionNotCreatedException\",\"logger\": \"org.openqa.selenium.grid.node.config.DriverServiceSessionFactory\",\"session.capabilities\": \"{\\\"LT:Options\\\": {\\\"selenium_version\\\": \\\"4.17.0\\\",\\\"build\\\": \\\"Sanity (run on 2024-03-07 07:01:26 PM)\\\",\\\"name\\\": \"seCdp\\\": true},\\\"acceptInsecureCerts\\\": true,\\\"browserName\\\": \\\"chrome\\\",\\\"goog:chromeOptions\\\": {\\\"args\\\": [\\\"--start-maximized\\\",\\\"--headless=new\\\"],\\\"extensions\\\": []},\\\"goog:loggingPrefs\\\": {\\\"browser\\\": \\\"INFO\\\"},\\\"platformName\\\": \\\"Windows 10\\\",\\\"se:name\\\": \\\"xml suite name: Sanity | xml test name: Sanity | test class: com.test | test method: test_Verify\\\",\\\"unhandledPromptBehavior\\\": \\\"accept\\\"}\\n\"}}\n","log-name": "org.openqa.selenium.remote.tracing.opentelemetry.SeleniumSpanExporter","log-time-local": "2024-03-07T20:01:28.499-07:00","log-time-utc": "2024-03-08T03:01:28.499Z","method": "lambda$export$3"}
2024-03-07-20:01:28 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "3ef65f90414049386404f5230796c42b","eventTime": 1709866888508487900,"eventName": "Unable to create session with the driver","attributes": {"current.session.count": 0,"logger": "org.openqa.selenium.grid.node.local.LocalNode","session.request.capabilities": "Capabilities {LT:Options: {build: Sanity (run on 202..., name: com.test...., seCdp: true, selenium_version: 4.17.0}, acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--start-maximized, --headless=new], extensions: []}, goog:loggingPrefs: {browser: INFO}, platformName: Windows 10, se:name: xml suite name: Sanity..., unhandledPromptBehavior: accept}","session.request.downstreamdialect": "[W3C]"}}

Screenshot 2024-03-08 at 1 40 51 PM copy

Is this still happening in 4.18.1? If so, please provide a way to reproduce the issue. Refer to #13562 (comment)

github-actions[bot] commented 8 months ago

Hi, @feller-kristina. This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team. Feel free to comment the issues that you raise back in this issue. Thank you.

titusfortner commented 8 months ago

Your capabilities are correct, if it is failing, it's a chromedriver issue.

diemol commented 8 months ago

It is expected that you use the hub URL. It doesn't make sense to use the Node directly if you have a Hub-Nodes setup. Otherwise, use Standalone.

diemol commented 8 months ago

Then use the Grid in Standalone mode and start many of them.

feller-kristina commented 8 months ago

I see the error I reported originally and it doesn't relate to Chrome. Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.util.concurrent.TimeoutException. Even there are available nodes.

d-rmm commented 7 months ago

I'm also seeing this issue, getting the error with everything using 4.18.1 images.

Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: Failed to read marionette port.

What's weird is I originally deployed everything to our kubernetes cluster by creating kustomize templates following the examples provided from here: https://github.com/kubernetes/examples/tree/master/staging/selenium

Tests with all drivers (Chrome, Edge and Firefox) all worked.

I then deleted everything and deployed with the helm chart provided in this repo, and the renders looked very similar. Difference mostly being the additional ConfigMaps / probes + healthchecks.

Now the Chrome + Edge work fine, but Firefox is failing.

JohnathanITAQa001 commented 7 months ago

I was having the same problem, but in my case it was mobile testing using the appium driver. After searching for a solution for a long time, I decided to check Selenium's compilation dependencies. That's when I saw that I didn't have some necessary dependencies, I added the dependencies as shown in MVN https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/4.18.1 (problem was in version 4.18.1 ) and everything started working normally again. Obviously I don't know if this is the best solution for this, but it worked for me.

vinodverma9171 commented 6 months ago

@JohnathanITAQa001 I am also facing the same issue, you added below 12 compile dependencies which is mentioned for https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/4.18.1? Also which java appium client you are using ?

Compile dependencies. (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v120) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v121) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v122) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v85) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-edge-driver) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-firefox-driver) https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-ie-driver) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver) (https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-safari-driver) https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support)

JohnathanITAQa001 commented 6 months ago

@vinodverma9171 I'm using the following deep declarations in my project: https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api https://mvnrepository.com/artifact/io.appium/java-client https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support https://mvnrepository.com/artifact/io.rest-assured/rest-assured https://mvnrepository.com/artifact/io.rest-assured/json-path https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all https://mvnrepository.com/artifact/org.postgresql/postgresql https://mvnrepository.com/artifact/com.google.code.gson/gson

And I'm also using the appium client v2.5.1

vinodverma9171 commented 6 months ago

@JohnathanITAQa001 Thanks. What exact version of appium java-client you are using. Are you using 9.2.2 ?

Also if you are using appium client 2.5.1 there is ongoing issue with connecting with selenium grid 4 version( getting HTTP/1.1 header parser received no bytes) , we can connect selenium grid 4 with appium client 2.3.0 or less version.

JohnathanITAQa001 commented 6 months ago

@vinodverma9171 The exact client version is: 9.2.0

ROM208 commented 6 months ago

I faced the same problem and the solution was to change the region in my lab settings, hope it works with you @feller-kristina

Screenshot 2024-04-29 000757

vinodverma9171 commented 6 months ago

I tried every suggested solution but still facing the same issue when running jobs in parallel.

SeleniumGrid version: 4.20.0 Java appium client: 9.2.2 Appium version: 2.3.0

Below two type of errors are alway intermittently coming.

  1. Could not start a new session. Response code 500. Message: java.net.http.HttpTimeoutException: request timed out Build info: version: '4.20.0', revision: '866c76ca80

  2. Could not start a new session. Response code 500. Message: java.util.concurrent.TimeoutException

github-actions[bot] commented 5 months ago

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.