Skip to content

Selenium 4 - Hub switches its state to "ready: false" #1167

Closed
@evertones

Description

@evertones

🐛 Bug Report

I am trying to run a suite of tests with Scala, ScalaTest and Selenium 4.
When I start more tests than the number of Selenium nodes I have available, I get an exception.
After the exception is thrown, if I access the hub URL http://localhost:4444/status ii shows the state of the hub as ready: false. The state of the nodes looks alright.

Below the exception received
*** RUN ABORTED *** (1 minute, 3 seconds)
  java.lang.ExceptionInInitializerError:
  at org.evertones.test.SuiteWith16Tests.<init>(SuiteWith16Tests.scala:28)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at java.lang.Class.newInstance(Class.java:442)
  at org.scalatest.tools.Runner$.genSuiteConfig(Runner.scala:1428)
  at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$8(Runner.scala:1236)
  at scala.collection.immutable.List.map(List.scala:283)
  at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1235)
  ...
  Cause: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0-alpha-7', revision: 'de8579b6d5'
System info: host: 'everton-pc', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-40-generic', java.version: '1.8.0_275'
Driver info: driver.version: RemoteWebDriver
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:522)
  at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:127)
  at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
  at org.evertones.selenium.WebDriverFactory.createRemoteInstance(WebDriverFactory.scala:16)
  at org.evertones.test.Selenium4Spec.<init>(Selenium4Spec.scala:15)
  at org.evertones.test.SuiteWith16Tests$.<init>(SuiteWith16Tests.scala:16)
  at org.evertones.test.SuiteWith16Tests$.<clinit>(SuiteWith16Tests.scala)
  at org.evertones.test.SuiteWith16Tests.<init>(SuiteWith16Tests.scala:28)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  ...
  Cause: java.lang.RuntimeException: NettyHttpHandler request execution error
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:72)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:47)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:60)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
  at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
  at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:139)
  ...
  Cause: java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:4444 after 60000 ms
  at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
  at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
  at org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:201)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:57)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:47)
  at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
  at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)
  at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:60)
  ...
  Cause: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:4444 after 60000 ms
  at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
  at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50)
  at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672)
  at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747)
  at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:472)
  at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
  at java.lang.Thread.run(Thread.java:748)
  ...

> Task :test FAILED

FAILURE: Build failed with an exception.
Below the output when accessed http://localhost:4444/status
{
  "value": {
    "ready": false,
    "message": "Selenium Grid not ready.",
    "nodes": [
      {
        "id": "55827655-511e-4da7-8414-642a9f7b3f88",
        "uri": "http:\u002f\u002f172.25.0.6:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 126,
                "moz:profile": "\u002ftmp\u002frust_mozprofilewEwB8M",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "52865d83-e9ce-40a9-bdb4-ee771a3110ff",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:46:17.153Z",
              "uri": "http:\u002f\u002flocalhost:29075"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "55827655-511e-4da7-8414-642a9f7b3f88",
              "id": "92d7ffb7-2aeb-473f-8010-399d93ba0c51"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "cdefe0bc-34d7-46e1-a789-3a81b26c8c8e",
        "uri": "http:\u002f\u002f172.25.0.5:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 145,
                "moz:profile": "\u002ftmp\u002frust_mozprofileQzqCgW",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "1c7f5105-c298-4fdf-aa53-1a5130e0de56",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:45:58.162Z",
              "uri": "http:\u002f\u002flocalhost:28420"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "cdefe0bc-34d7-46e1-a789-3a81b26c8c8e",
              "id": "57d078b1-78db-4d85-bfa3-14756a727b73"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "1ee36a5b-093f-4ea8-9a45-3a427d1e5f83",
        "uri": "http:\u002f\u002f172.25.0.8:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 127,
                "moz:profile": "\u002ftmp\u002frust_mozprofile8U9rzw",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "8f8defbc-398f-4c42-b620-5daf65aff006",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:46:11.771Z",
              "uri": "http:\u002f\u002flocalhost:24482"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "1ee36a5b-093f-4ea8-9a45-3a427d1e5f83",
              "id": "2d427496-e0af-432a-8172-e3225d6937ac"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "9c95f9cd-58c6-491f-bb58-0ee9508aa502",
        "uri": "http:\u002f\u002f172.25.0.9:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 127,
                "moz:profile": "\u002ftmp\u002frust_mozprofilekA9gX6",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "73daaee9-5943-4540-81c5-a739ddaa00e9",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:45:53.882Z",
              "uri": "http:\u002f\u002flocalhost:24808"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "9c95f9cd-58c6-491f-bb58-0ee9508aa502",
              "id": "3e54e66e-dca3-4623-8cd0-3050df82f49f"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "5a41a936-8ba2-4df6-adbe-1d006fb20923",
        "uri": "http:\u002f\u002f172.25.0.7:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 146,
                "moz:profile": "\u002ftmp\u002frust_mozprofileLSKslW",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "a09e9f89-5819-4dfb-9bd7-0fd1f91601d7",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:46:23.389Z",
              "uri": "http:\u002f\u002flocalhost:3067"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "5a41a936-8ba2-4df6-adbe-1d006fb20923",
              "id": "36cbe8bf-317b-4642-8e08-8b4709db514f"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "91bdd298-6101-4174-9a55-d3128455286c",
        "uri": "http:\u002f\u002f172.25.0.3:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 144,
                "moz:profile": "\u002ftmp\u002frust_mozprofile4L1hK2",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "347932c0-b1d2-4d8b-8132-1aefade06abc",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:45:44.973Z",
              "uri": "http:\u002f\u002flocalhost:10320"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "91bdd298-6101-4174-9a55-d3128455286c",
              "id": "cf132e13-7e15-40bb-afb2-5e2fc6132b1b"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "0cd8e479-de20-43b7-adcf-3ba10ab6c405",
        "uri": "http:\u002f\u002f172.25.0.10:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 145,
                "moz:profile": "\u002ftmp\u002frust_mozprofileBJIsnP",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "5ee0ef73-add2-41e6-88aa-216d4d4082e2",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:46:06.885Z",
              "uri": "http:\u002f\u002flocalhost:4424"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "0cd8e479-de20-43b7-adcf-3ba10ab6c405",
              "id": "733cbc04-4529-4210-8e5c-818f4724d0a6"
            }
          }
        ],
        "availability": "UP"
      },
      {
        "id": "dde398ff-c8cc-4e60-855d-a4c3a3d542c9",
        "uri": "http:\u002f\u002f172.25.0.4:5555",
        "maxSessions": 1,
        "slots": [
          {
            "lastStarted": "1970-01-01T00:00:00Z",
            "session": {
              "capabilities": {
                "acceptInsecureCerts": true,
                "browserName": "firefox",
                "browserVersion": "83.0",
                "moz:accessibilityChecks": false,
                "moz:buildID": "20201112153044",
                "moz:geckodriverVersion": "0.28.0",
                "moz:headless": false,
                "moz:processID": 145,
                "moz:profile": "\u002ftmp\u002frust_mozprofiley0PnSU",
                "moz:shutdownTimeout": 60000,
                "moz:useNonSpecCompliantPointerOrigin": false,
                "moz:webdriverClick": true,
                "pageLoadStrategy": "normal",
                "platformName": "linux",
                "platformVersion": "5.4.39-linuxkit",
                "rotatable": false,
                "setWindowRect": true,
                "strictFileInteractability": false,
                "timeouts": {
                  "implicit": 0,
                  "pageLoad": 300000,
                  "script": 30000
                },
                "unhandledPromptBehavior": "dismiss and notify"
              },
              "sessionId": "7af81ed5-551b-428c-b00f-9321e8412cca",
              "stereotype": {
                "browserName": "firefox"
              },
              "start": "2020-12-19T04:46:02.012Z",
              "uri": "http:\u002f\u002flocalhost:4380"
            },
            "stereotype": {
              "browserName": "firefox"
            },
            "id": {
              "hostId": "dde398ff-c8cc-4e60-855d-a4c3a3d542c9",
              "id": "ca1de0c0-6d04-44d5-b32e-64f52513cb8f"
            }
          }
        ],
        "availability": "UP"
      }
    ]
  }
}

I've tried this with both Chrome and Firefox.

To Reproduce

I have created a repository in Github to reproduce the issue.
More details below in the section Test script reproducing this issue (when applicable).

Here's the docker-compose.yml file to start the containers.

version: "3"

services:
  selenium-hub:
    image: selenium/hub:4.0.0-beta-1-prerelease-20201208
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    environment:
      - JAVA_OPTS=-Xms2g -Xmx8g

  chrome:
    image: selenium/node-chrome:4.0.0-beta-1-prerelease-20201208
    volumes:
      - /dev/shm:/dev/shm
    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.0.0-beta-1-prerelease-20201208
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

The command:

docker-compose up -d --scale chrome=8

OR

docker-compose up -d --scale firefox=8

Expected behavior

When the tests I want to run are executed, I would expect that all of them would run without errors like the exception mentioned in the bug report section.

If any error happens, I would expect to see in the container LOGs, but nothing is reported there.
I try to check it by running docker-compose logs and cannot find any error.

Test script reproducing this issue (when applicable)

I have created a repository in Github where it's easy to reproduce the error.
I could reproduce on a Mac and on a Linux with Ubuntu.

The steps to reproduce:

  • clone the repo from https://github.com/evertones/selenium4-scala.git
  • start docker from the folder docker using the command docker-compose up -d --scale chrome=8
  • start the test from the root of the project using the command ./gradlew clean test -Ptest.suite=SuiteWith8Tests
    • this should PASS
  • start the test from the root of the project using the command ./gradlew clean test -Ptest.suite=SuiteWith16Tests
    • this should FAIL with the exception mentioned in the bug report section

Environment

OS: OSX Mojare 10.14.6 AND Ubuntu 18.04.3 LTS (reproduced in both)
Docker-Selenium image version: 4.0.0-beta-1-prerelease-20201208
Also provide the docker image id:

REPOSITORY                    TAG                                IMAGE ID            CREATED             SIZE
selenium/node-firefox         4.0.0-beta-1-prerelease-20201208   e4e8321ff65b        10 days ago         893MB
selenium/node-chrome          4.0.0-beta-1-prerelease-20201208   ec32fe614b4c        10 days ago         959MB
selenium/hub                  4.0.0-beta-1-prerelease-20201208   0bdb0e2f0ead        10 days ago         275MB

Docker version:

  • Mac: 19.03.13
  • Linux: 18.09.0

Docker-Compose version (if applicable):

  • Mac: 1.27.4
  • Linux: 1.25.4

Exact Docker command to start the containers (if using docker-compose, provide
the docker-compose file as well):

  • docker-compose up -d --scale chrome=8 (docker-compose was attached above)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions