seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
249 stars 26 forks source link

[🐛 Bug]: org.openqa.selenium.TimeoutException when running test suite in parallel #47

Closed daniel-urrutia closed 5 months ago

daniel-urrutia commented 1 year ago

What happened?

Environment: 'Mac OS X', os.arch: 'aarch64', os.version: '13.3.1', java.version: '17.0.7' (Apple M1 Pro - MacBook Pro) Issue:

I've been trying to run my Cucumber test suite in parallel using seleniarm/hub with seleniarm/node-chromium attached with no success.

Some of the scenarios pass as expected but then at random some scenarios start to fail due to SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Here is my docker-compose.yml:

version: '3.9'

services:
  selenium-hub:
    image: seleniarm/hub:4.10.0
    platform: linux/arm64
    ports:
      - '4442:4442'
      - '4443:4443'
      - '4444:4444'

  chrome:
    image: seleniarm/node-chromium:116.0
    depends_on:
      - selenium-hub
    volumes:
      - /dev/shm:/dev/shm
    shm_size: 2gb
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_SESSION_TIMEOUT=25
      - SE_NODE_MAX_INSTANCE=2
      - SE_NODE_MAX_SESSIONS=2

Command used to start Selenium Grid with Docker

docker-compose -f docker-compose.ci.yml up -d

Relevant log output

com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'CO-WGX3DTH1H4', ip: '2600:1700:9e98:c010:0:0:0:44%en0'
  while locating WebDriverProvider
  at WebDriverModule.configure(WebDriverModule.java:44)
  at ActionsProvider.<init>(ActionsProvider.java:14)
      \_ for 1st parameter
  while locating ActionsProvider
  at WebDriverModule.configure(WebDriverModule.java:45)
  at DoubleClick.<init>(DoubleClick.java:16)
      \_ for 1st parameter
  at Actor.<init>(Actor.java:45)
      \_ for 1st parameter doubleClick
  at alo.yoga.ui.tests.stepDefinitions.Hooks.<init>(Hooks.java:37)
      \_ for 1st parameter
  at alo.yoga.ui.tests.stepDefinitions.Hooks.class(Hooks.java:37)
  while locating alo.yoga.ui.tests.stepDefinitions.Hooks

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
ActionsProvider:            "alo.yoga.ui.tests.guice.providers.selenium.ActionsProvider"
Actor:                      "alo.yoga.ui.tests.actor.Actor"
DoubleClick:                "alo.yoga.ui.tests.actor.tasks.click.DoubleClick"
SessionNotCreatedException: "org.openqa.selenium.SessionNotCreatedException"
WebDriverModule:            "alo.yoga.ui.tests.guice.modules.WebDriverModule"
WebDriverProvider:          "alo.yoga.ui.tests.guice.providers.selenium.WebDriverProvider"
========================
End of classname legend:
========================

    at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1151)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
    at io.cucumber.guice.GuiceFactory.getInstance(GuiceFactory.java:88)
    at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
    at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:64)
    at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
    at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
    at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
    at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:84)
    at io.cucumber.core.runner.TestStep.run(TestStep.java:56)
    at io.cucumber.core.runner.TestCase.run(TestCase.java:78)
    at io.cucumber.core.runner.Runner.runPickle(Runner.java:75)
    at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:112)
    at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:137)
    at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
    at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:137)
    at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109)
    at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168)
    at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
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. 
Host info: host: 'CO-WGX3DTH1H4', ip: '2600:1700:9e98:c010:0:0:0:44%en0'
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:536)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:232)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:159)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
    at alo.yoga.ui.tests.guice.providers.selenium.WebDriverProvider.getChromeDriver(WebDriverProvider.java:33)
    at alo.yoga.ui.tests.guice.providers.selenium.WebDriverProvider.get(WebDriverProvider.java:64)
    at alo.yoga.ui.tests.guice.providers.selenium.WebDriverProvider.get(WebDriverProvider.java:22)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:59)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at io.cucumber.guice.SequentialScenarioScope.lambda$scope$0(SequentialScenarioScope.java:40)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:58)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at io.cucumber.guice.SequentialScenarioScope.lambda$scope$0(SequentialScenarioScope.java:40)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at io.cucumber.guice.SequentialScenarioScope.lambda$scope$0(SequentialScenarioScope.java:40)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
    ... 33 more
Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '13.3.1', java.version: '17.0.7'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:65)
    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:55)
    at org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:48)
    at org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:96)
    at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:54)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:115)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
    at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
    ... 74 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.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)
    at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:59)
    ... 85 more

Operating System

Mac OS Ventura 13.3

Docker Selenium version (tag)

4.10

daniel-urrutia commented 1 year ago

I'm finding that if I increase the amount of memory in shm_size and increase the timeout SE_NODE_SESSION_TIMEOUT the tests run successfully and I don't see the SessionNotCreatedException.

Though the exception is still raised when I try to run a bigger set of tests.

jamesmortensen commented 1 year ago

Does this also happen with previous versions of docker-seleniarm?

diemol commented 5 months ago

Closing this because we never got a reply.

github-actions[bot] commented 4 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.