SeleniumHQ / SeleniumHQ/docker-selenium

[🐛 Bug]: Driver took too long to build. This is likely an issue with the browser or driver

Open
#2,470 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triaging
Dominant language
Go
Stars
8.7k
Forks
2.5k
Avg merge
10h 16m
Merged PRs (30d)
20

Description

What happened?

Hello, We are using Selenium Grid V4 and run tests via selenium-ide-runner.
When we run a large number of tests, they become queued and wait to be executed. But when 30 seconds pass and the test has not started, we get an error on Timeout.
image

It can be passed by increasing timeout hard-coded in script webdriver.ts
image

How is it possible to avoid this error or is it possible to define this Timeout for WebDriver via ${variable} ?

Command used to start Selenium Grid with Docker (or Kubernetes)
docker-compose-selenium-hub.yml:
---
services:
  selenium-hub:
    image: "docker.local:5000/selenium/hub:4.23.1"
    container_name: isos-selenium-hub
    ports:
      - 4442:4442
      - 4443:4443
      - 127.0.0.1:4444:4444
    volumes:
      - /etc/localtime:/etc/localtime:ro
    networks:
      - selenium-grid
    #deploy:
     # resources:
      #  limits:
       #   cpus: "1.0"
        #  memory: 512M
    environment:
      - SE_SESSION_REQUEST_TIMEOUT=10000
      - GRID_TIMEOUT=120
      - SE_ENABLE_TRACING=false
      - SE_ENABLE_TLS=true
      - SE_LOG_LEVEL=FINE
      - SE_STRUCTURED_LOGS=true
    restart: always
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"

networks:
  selenium-grid:
---------------------------------
docker-compose-selenium-side-runner.yml    
---------------------------------
services:
  isos_selenium_runner:
    image: docker.local:5000/isos_selenium_runner:33 
    container_name: isos-selenium-cli
    networks:
      - selenium-grid
    environment:
      - SE_HUB_HOST=selenium-hub
      - SE_HUB_PORT=4444  
      
    env_file:
      - selenium.env
    volumes:
      - test_results:/opt/isos/selenium/test_results  # Mount directory for results;
      - screenshots:/opt/isos/selenium/screenshots
      - /etc/localtime:/etc/localtime:ro
    deploy:
      resources:
        limits:
       #   cpus: '1'
          memory: 4.5g
    restart: always
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    command: ["/bin/bash", "-c", "builtin declare -p | grep -Ev '\\b(BASHOPTS|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID)=' > /container.env && crond && tail -f /dev/null"]

volumes:
  test_results:
  screenshots:

networks:
  selenium-grid:
    
----------------------------------------
docker-compose-chrome-node.yml
----------------------------------------
---
services:
  chrome:
    image: "docker.local:5000/selenium/node-chrome:4.23.1-20240820"
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_GRID_URL=https://selenium-hub:4444/wd/hub   # HTTPS address to register on Hub
      - SE_ENABLE_TLS=true
      - SE_ENABLE_TRACING=false
      - SE_SERVER_PROTOCOL=https
      - SE_START_XVFB=false
      - SE_NODE_SESSION_TIMEOUT=30                 #if a session in a stale state, will be killed
      - SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true      #to enable the cleanup
      - SE_BROWSER_LEFTOVERS_INTERVAL_SECS=240       #cleanup interval in seconds
      - SE_BROWSER_LEFTOVERS_PROCESSES_SECS=180      #browsers running for longer than this time will be killed
      - SE_BROWSER_LEFTOVERS_TEMPFILES_DAYS=1         #files generated by Chrome-based browsers in /tmp will be removed after these number of days (ignored when using Firefox)
      - SE_START_VNC=false
      #- SE_NODE_MAX_SESSIONS=2                      # 2 sessions will be active per container;
      - SE_LOG_LEVEL=FINE
      - SE_STRUCTURED_LOGS=true
      
    volumes:
      - /etc/localtime:/etc/localtime:ro
    networks:
      - selenium-grid
    deploy:
      replicas: 2
      resources:
        limits:
          cpus: "2.0"
          memory: 4G
    restart: always
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "3"

networks:
  selenium-grid:
Relevant log output
"Error: Driver took too long to build. This is likely an issue with the browser or driver.\n    at Timeout._onTimeout (/usr/local/lib/node_modules/selenium-side-runner/node_modules/@seleniumhq/side-runtime/src/webdriver.ts:200:13)\n    at listOnTimeout (node:internal/timers:594:17)\n    at processTimers (node:internal/timers:529:7)"
Operating System

Rocky Linux 9

Docker Selenium version (image tag)

4.23.1

Selenium Grid chart version (chart version)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the timeout reported at webdriver.ts:200 and compare it with the Selenium Grid environment settings in the supplied Docker Compose files. Check how selenium-side-runner handles queued sessions and whether this timeout is configurable. Done means queued tests no longer fail unexpectedly, with the supported configuration or limitation documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, node.js, typescript
Domain
devops, distributed-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.