Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: getting java.lang.RuntimeException: org.openqa.selenium.SessionNotCreatedException:with RemoteWebDriver with latest 4.6.0 grid and selenium 4.6.0 #11327

Closed
pavanwashimkar opened this issue Nov 28, 2022 · 10 comments

Comments

@pavanwashimkar
Copy link

What happened?

As per the solution provided under below issue.
java.util.concurrent.TimeoutException thrown at random netty read timeouts with RemoteWebDriver #9528

I tried but not able to fix this and still getting the same issue.
Can someone please help.

java.lang.RuntimeException: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Tried below after installing distr grid latest version (4.6.0)

Include selenium-http-jdk-client. with maven you would do this:

org.seleniumhq.selenium
selenium-http-jdk-client
${selenium.version}

Before creating WebDriver() call:
System.setProperty("webdriver.http.factory", "jdk-http-client");

How can we reproduce the issue?

This is similar to 
https://github.com/SeleniumHQ/selenium/issues/9528

Relevant log output

Failure cause ==> 
build	25-Nov-2022 08:05:38	java.lang.RuntimeException: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
build	25-Nov-2022 08:05:38	Host info: host: 'ip-10-61-70-108.ap-southeast-2.compute.internal', ip: '10.61.70.108'
build	25-Nov-2022 08:05:38		at com..test.lib.web.ui.DriverHelper.startChromeDriver(DriverHelper.java:180) ~[test-framework-core-7.0.1-seleniumUpgradeTo4.0.6.0-SNAPSHOT.jar:?]
build	25-Nov-2022 08:05:38		at com..test.lib.web.ui.DriverHelper.launchBrowser(DriverHelper.java:63) ~[test-framework-core-7.0.1-seleniumUpgradeTo4.0.6.0-SNAPSHOT.jar:?]
build	25-Nov-2022 08:05:38		at b2c.e2e.it.common.stepdefs.agentConsoleStepsTemp.<init>(agentConsoleStepsTemp.java:51) ~[test-classes/:?]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
build	25-Nov-2022 08:05:38		at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678) ~[picocontainer-2.15.jar:?]
build	25-Nov-2022 08:05:38		at io.cucumber.picocontainer.PicoFactory.getInstance(PicoFactory.java:49) ~[cucumber-picocontainer-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47) ~[cucumber-java-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29) ~[cucumber-java-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:85) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.TestStep.run(TestStep.java:57) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.TestCase.run(TestCase.java:84) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runner.Runner.runPickle(Runner.java:75) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$1(TestNGCucumberRunner.java:132) ~[cucumber-testng-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:129) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:129) ~[cucumber-core-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:129) ~[cucumber-testng-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:35) ~[cucumber-testng-7.3.4.jar:7.3.4]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
build	25-Nov-2022 08:05:38		at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
build	25-Nov-2022 08:05:38		at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
build	25-Nov-2022 08:05:38		at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132) ~[testng-7.3.0.jar:?]
build	25-Nov-2022 08:05:38		at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599) ~[testng-7.3.0.jar:?]
build	25-Nov-2022 08:05:38		at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174) ~[testng-7.3.0.jar:?]
build	25-Nov-2022 08:05:38		at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77) ~[testng-7.3.0.jar:?]
build	25-Nov-2022 08:05:38		at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15) ~[testng-7.3.0.jar:?]
build	25-Nov-2022 08:05:38		at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
build	25-Nov-2022 08:05:38		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
build	25-Nov-2022 08:05:38		at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
build	25-Nov-2022 08:05:38		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
build	25-Nov-2022 08:05:38		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
build	25-Nov-2022 08:05:38		at java.lang.Thread.run(Thread.java:829) ~[?:?]
build	25-Nov-2022 08:05:38	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

Linux

Selenium version

selenium-java/4.6.0,selenium-http-jdk-client-4.6.0,System info: os.name: 'Linux', java.version: '11.0.12

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?

ChromeDriver 107 (latest version)

Are you using Selenium Grid?

4.6.0

@github-actions
Copy link

@pavanwashimkar, 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!

@pujagani
Copy link
Contributor

pujagani commented Nov 28, 2022

Thank you for sharing the details. I have a few questions.

  1. The logs shared show an error that is related to browser-start-up. But the bug title mentions TimeoutException. I am confused regarding the exact problem faced. I will appreciate the exact exception faced. Are you also seeing TimeoutException?
  2. The issue is no longer Netty related if Java 11 HTTP Client is used. Can you please update the bug title accordingly? Thank you!
  3. Is the Grid also using Java 11 HTTP client? If not, can you please try to add it to the Grid and see if the error still occurs? https://www.selenium.dev/blog/2022/using-java11-httpclient/#using-the-java-11-client-in-grid
  4. Please provide a reproducible test script. The related issue mentioned regarding the timeout has an example to reproduce the issue that resulted in a TimeoutException. Understanding the code snippet on your end causing this will help us triage it.
  5. How often does this happen?

Thank you!

@pavanwashimkar pavanwashimkar changed the title [🐛 Bug]: Still getting java.util.concurrent.TimeoutException thrown at random netty read timeouts with RemoteWebDriver [🐛 Bug]: getting java.lang.RuntimeException: org.openqa.selenium.SessionNotCreatedException:with RemoteWebDriver with latest 4.6.0 grid and selenium 4.6.0 Nov 28, 2022
@pavanwashimkar
Copy link
Author

@pujagani , Thanks for prompt response.

  1. We were working on fixing concurrent.TimeoutIssue and end up in this session not created issue now. Updated the title of the issue.
  2. Yes using java 11 HTTP client.
  3. The grid we are running in distributed mode and dont have option to pass the version. But as per the comments under issue java.util.concurrent.TimeoutException thrown at random netty read timeouts with RemoteWebDriver #9528, latest version of grid (4.6.0) should already be running on java 11. Please guide me on this.
  4. We wont be able to provide you script due to restriction but i will try to see if i can create some test which i can share.
  5. This is happening frequently.

@pujagani
Copy link
Contributor

Thank you for your response.

  1. Thank you for updating it.
  2. Got it 👍
  3. 4.6 does not use the Java 11 client by default. As mentioned earlier, please refer to the documentation attached https://www.selenium.dev/blog/2022/using-java11-httpclient/#using-the-java-11-client-in-grid to see how the Grid can use Java 11 HTTP Client. The command remains the same even for distributed mode. The flags need to be passed for all Grid components and it will then use Java 11 HTTP Client. I am sensing the issue is still seen since the Grid is not using the Java 11 client on your end.
  4. Any test scripts that allow us to reproduce the issue are required so we can triage it.
  5. Any numbers around this? Ex: 5 times in 100 runs or similar

@pavanwashimkar
Copy link
Author

pavanwashimkar commented Nov 28, 2022

Hi @pujagani ,

Thanks for the input.
Also we are running the grid via docker(distributed mode 4.6.0). Do you by any chance know how to pass these variables (Dwebdriver.http.factory=jdk-http-client and —-ext flags) inside docker.

@pujagani
Copy link
Contributor

Apologies, I did not know you were running the Grid in docker. In 4.6.0 it defaults to using the Java 11 client when using docker. So you are good on that front. We will need a reproducible test script to reproduce the error.

@pavanwashimkar
Copy link
Author

Hi @pujagani , I am still working on the process to share few test cases with you. Meanwhile just wanted to give some inputs which might help you in debugging this issue.

  1. We are using cucumber(version 7.3.4)) test cases and running them using testng(version 7.3.0). Even with junit runner facing same issue.
  2. using testng profile, we running the test cases in parallel mode (around 10-20 test cases ) as well giving the same issue.
  3. Few test cases are running and few are giving SessionNotCreatedException.
  4. In every run I could see test cases failing with this error.

@pujagani
Copy link
Contributor

I appreciate the details. However, the test framework used does not help much unless the issue is related to it. The goal is to isolate the issue to Selenium and narrow it down so we can triage and fix it. Thank you for putting the test cases together. Since you are using docker and have a test framework setup, it might be a good idea to put everything in a Github repo with instructions on how to run it so we can reproduce it exactly. Even standalone test cases or reproducible code snippets are fine as long the error is reproducible.

@diemol
Copy link
Member

diemol commented Dec 9, 2022

Closing as we did not get more concrete information.

@diemol diemol closed this as completed Dec 9, 2022
@github-actions
Copy link

github-actions bot commented Jan 9, 2023

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants