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

onError java.net.SocketException: Connection reset #15

Closed
kazurayam opened this issue Oct 28, 2023 · 3 comments
Closed

onError java.net.SocketException: Connection reset #15

kazurayam opened this issue Oct 28, 2023 · 3 comments

Comments

@kazurayam
Copy link
Owner

In the kazurayam8b branch, I ran io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldChromeJUnit4Test and got the following WARNING with a Stacktrace:

> Task :selenium-webdriver-junit4:compileJava UP-TO-DATE
> Task :selenium-webdriver-junit4:processResources UP-TO-DATE
> Task :selenium-webdriver-junit4:classes UP-TO-DATE
> Task :selenium-webdriver-junit4:compileTestJava
> Task :selenium-webdriver-junit4:processTestResources UP-TO-DATE
> Task :selenium-webdriver-junit4:testClasses
2023-10-28 18:05:11 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.<init>(225) - Using WebDriverManager 5.5.3
2023-10-28 18:05:12 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.checkValidity(156) - Removing resolution chrome=118 from cache (expired on Fri Oct 27 22:53:04 JST 2023)
2023-10-28 18:05:13 [Test worker] DEBUG i.g.b.wdm.versions.VersionDetector.getBrowserVersionFromTheShell(259) - Detecting chrome version using online commands.properties
2023-10-28 18:05:13 [Test worker] DEBUG i.g.bonigarcia.wdm.versions.Shell.runAndWaitArray(65) - Running command on the shell: [/Applications/Google Chrome.app/Contents/MacOS/Google Chrome, --version]
2023-10-28 18:05:13 [Test worker] DEBUG i.g.bonigarcia.wdm.versions.Shell.runAndWaitArray(69) - Result: Google Chrome 118.0.5993.117
2023-10-28 18:05:13 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.checkKeyInResolutionCache(186) - Resolution chrome118=118.0.5993.70 in cache (valid until 21:53:04 28/10/2023 JST)
2023-10-28 18:05:13 [Test worker] INFO  i.g.bonigarcia.wdm.WebDriverManager.resolveDriverVersion(1217) - Using chromedriver 118.0.5993.70 (resolved driver for Chrome 118)
2023-10-28 18:05:13 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.putValueInResolutionCacheIfEmpty(119) - Storing resolution chrome=118 in cache (valid until 19:05:13 28/10/2023 JST)
2023-10-28 18:05:13 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.manage(1172) - Driver chromedriver 118.0.5993.70 found in cache
2023-10-28 18:05:13 [Test worker] INFO  i.g.bonigarcia.wdm.WebDriverManager.exportDriver(1270) - Exporting webdriver.chrome.driver as /Users/kazuakiurayama/.cache/selenium/chromedriver/mac64/118.0.5993.70/chromedriver
Oct 28, 2023 6:05:26 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 118, so returning the closest version found: 117
2023-10-28 18:05:27 [Test worker] DEBUG i.g.b.w.j.c.h.HelloWorldChromeJUnit4Test.test(60) - The title of https://bonigarcia.dev/selenium-webdriver-java/ is Hands-On Selenium WebDriver with Java
2023-10-28 18:05:28 [AsyncHttpClient-1-4] WARN  o.a.netty.handler.WebSocketHandler.handleException(142) - onError
java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
	at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
	at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
Oct 28, 2023 6:05:28 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Connection reset
java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
	at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
	at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:254)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

> Task :selenium-webdriver-junit4:test
io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldChromeJUnit4Test > test PASSED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 23s
5 actionable tasks: 2 executed, 3 up-to-date
18:05:28: Execution finished ':selenium-webdriver-junit4:test --tests "io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldChromeJUnit4Test.test"'.
@kazurayam
Copy link
Owner Author

kazurayam commented Oct 28, 2023

This seems to have something to do with

which includes a post

titusfortner commented on Mar 9
AsyncHttp Client has not been actively maintained (looks like this just changed), so we've been requesting people upgrade to the Java 11 HTTP client https://www.selenium.dev/blog/2022/using-java11-httpclient/
Looks like latest version of AsyncHttp still relies on Netty 4 and is compiled with Java 11 anyway? So I don't think continuing with that library is going to be the solution regardless.


Artur- commented [on Mar 9]
(SeleniumHQ/selenium#11750 (comment))
Adding

       <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-http-jdk-client</artifactId>
        </dependency>

and

        System.setProperty("webdriver.http.factory", "jdk-http-client");

makes tests work again

@kazurayam
Copy link
Owner Author

NettyClient and JdkHttpClient?

This issue closely related to the following issue as well:

@kazurayam
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant