question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: org.asynchttpclient.exception.RemotelyClosedException when starting 3 tests at once with Sauce Labs

See original GitHub issue

What happened?

Not sure if this belongs here or in Sauce Labs but:

When starting three simple tests at the same time with Selenium 4.3.0 the end result is always (at least on my M1 Mac) that test 1 and test 3 run and work fine (although in Saucelabs they show up as ‘errored’) but test 2 fails to start with

org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failur
e.
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'myhostname', ip: 'myip', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.4', java.ver
sion: '17.0.1'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extens
ions: []}, sauce:options: {access_key: <key removed>, name: test2, tunnelIdentifier: my-tunnel-id, username: my-sa
uce-username}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions:
 []}, sauce:options: {access_key: <key removed>, name: test2, tunnelIdentifier: my-tunnel-id, username: my-sauce-u
sername}}}]
Capabilities {}
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:587)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:264)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:179)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
        at com.example.application.MyIT.test(MyIT.java:52)
        at com.example.application.MyIT.test2(MyIT.java:30)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
        at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
        at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
        at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
        at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.io.UncheckedIOException: org.asynchttpclient.exception.RemotelyClosedException: Remotely closed
        at org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:73)
        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:49)
        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:98)
        at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:120)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
        ... 42 more
Caused by: org.asynchttpclient.exception.RemotelyClosedException: Remotely closed
        at org.asynchttpclient.exception.RemotelyClosedException.INSTANCE(Unknown Source)

How can we reproduce the issue?

https://github.com/Artur-/saucetest

Relevant log output

The full log of one run can be found here https://gist.github.com/Artur-/5e5ec1b70949560b1e75361ba27145a4

Operating System

macOs Big Sur

Selenium version

4.3.0

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?

Remotedriver + Saucelabs

Are you using Selenium Grid?

No

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
diemolcommented, Jul 12, 2022

I was able to reproduce this with the provided code, but then I noticed you are using the old endpoint. Then I used the new endpoint and it all worked fine. Check the endpoints here https://docs.saucelabs.com/basics/data-center-endpoints/#data-center-endpoints.

In short:

RemoteWebDriver driver = new RemoteWebDriver(new URL("https://ondemand.us-west-1.saucelabs.com/wd/hub"), cap);
0reactions
github-actions[bot]commented, Aug 12, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Error Messages - Sauce Labs Documentation
Below are some Sauce Labs automated testing common error messages and how to fix them.
Read more >
Troubleshooting | Sauce Labs Documentation
A typical error message that the Sauce Connect Proxy prints when it fails to connect to Sauce Labs would say something like this:...
Read more >
Could not start a new session. Possible causes are invalid ...
This error covers a range of issues when starting a session ... causes are invalid address of the remote server or browser start-up...
Read more >
Java can't start a saucelabs session due to error: PKIX path ...
Does this appear in your Java stack trace while trying to start a test with Sauce Labs? javax.net.ssl.SSLHandshakeException:...
Read more >
Authentication Error with Selenium 3.9.0 Java Client Bindings
... you may see an error when trying to start tests using Sauce Labs (or ... WebDriverException: Unable to parse remote response: Sauce...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found