javaseleniumselenium-chromedriverselenium-gridselenium4

Selenium grid with chrome crashes with 4.5 nodes


I have m1 chip laptop on which I am running docker with the below yml file to run the grid with nodes of different browsers which gets attached correct to the hub but while running the test on chrome it crashes and never kicks of the test where works fine in firefox.

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
  chrome:
    image: selenium/node-chrome:4.5.0-20221017
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  edge:
    image: selenium/node-edge:4.5.0-20221017
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  firefox:
    image: selenium/node-firefox:4.5.0-20221017
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-hub:
    image: selenium/hub:4.5.0-20221017
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

Here is the docker compose file. The test code I am using is

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setCapability(CapabilityType.UNHANDLED_PROMPT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
driver = new RemoteWebDriver(new URL("http://localhost:4444/"),chromeOptions);
driver.manage().window().maximize();
driver.get("https://stackoverflow.com/");

selenium-hub | 11:19:50.008 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: unknown error: Chrome failed to start: crashed.
selenium-hub |   (unknown error: DevToolsActivePort file doesn't exist)
selenium-hub |   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 
selenium-hub | Host info: host: '6857544abb6a', ip: '172.18.0.3'
selenium-hub | Build info: version: '4.5.0', revision: 'fe167b119a'
selenium-hub | System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
selenium-hub | Driver info: driver.version: unknown
selenium-hub | Build info: version: '4.5.0', revision: 'fe167b119a'
selenium-hub | System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
selenium-hub | Driver info: driver.version: unknown
selenium-hub | Build info: version: '4.5.0', revision: 'fe167b119a'
selenium-hub | System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'
selenium-hub | Driver info: driver.version: unknown
selenium-hub |  at org.openqa.selenium.grid.node.remote.RemoteNode.newSession(RemoteNode.java:150)
selenium-hub |  at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:639)
selenium-hub |  at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:558)
selenium-hub |  at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:812)
selenium-hub |  at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:773)
selenium-hub |  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
selenium-hub |  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
selenium-hub |  at java.base/java.lang.Thread.run(Thread.java:829)
selenium-hub | 
selenium-hub | 11:19:50.011 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "f043d429f257e3b7a5422356635be50f","eventTime": 1666178390003999793,"eventName": "exception","attributes": {"exception.message": "Unable to create session: 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: unknown error: Chrome failed to start: crashed.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location \u002fusr\u002fbin\u002fgoogle-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: '6857544abb6a', ip: '172.18.0.3'\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown","exception.stacktrace": "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: unknown error: Chrome failed to start: crashed.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location \u002fusr\u002fbin\u002fgoogle-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) \nHost info: host: '6857544abb6a', ip: '172.18.0.3'\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\nBuild info: version: '4.5.0', revision: 'fe167b119a'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.124-linuxkit', java.version: '11.0.16'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.grid.node.remote.RemoteNode.newSession(RemoteNode.java:150)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:639)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:558)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:812)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:773)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:829)\n","exception.type": "org.openqa.selenium.SessionNotCreatedException","logger": "org.openqa.selenium.grid.distributor.local.LocalDistributor","request.payload": "[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, unhandledPromptBehavior: ignore}]"}}
selenium-hub | 
selenium-hub | 11:19:50.024 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "f043d429f257e3b7a5422356635be50f","eventTime": 1666178390028315173,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "localhost:4444","http.method": "POST","http.request_content_length": "451","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession","http.user_agent": "selenium\u002f4.5.0 (java mac)"}}
selenium-hub | 


Solution

  • Try using seleniarm/hub instead of selenium/hub, that's a community based version of the official images, built for multiple chipset architectures. https://github.com/seleniumhq-community/docker-seleniarm