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

Nima HTTP/2 - Writing to closed socket error #6871

Closed
danielkec opened this issue May 22, 2023 · 0 comments · Fixed by #6887
Closed

Nima HTTP/2 - Writing to closed socket error #6871

danielkec opened this issue May 22, 2023 · 0 comments · Fixed by #6887
Assignees
Labels
4.x Version 4.x bug Something isn't working Níma Helidon Níma P2

Comments

@danielkec
Copy link
Contributor

danielkec commented May 22, 2023

When h2load gets interrupted mid-test, Nima logs errors because of write attempts to closed socket.

h2load -n 10000000000 -t 64 -c 64 -m 1000 https://tfb-server:8081/plaintext
2023.05.22 13:52:20.647 [0x6d40fe0c 0x1f5bee11] Request failed: HttpPrologue[protocol=HTTP, protocolVersion=2.0, method=GET, uriPath=/plaintext, query=, fragment=], cannot send error response, as response already sent
io.helidon.common.http.RequestException: java.io.UncheckedIOException: java.net.SocketException: Socket closed
	at io.helidon.common.http.RequestException$Builder.build(RequestException.java:126)
	at io.helidon.nima.webserver.http.ErrorHandlers.unhandledError(ErrorHandlers.java:201)
	at io.helidon.nima.webserver.http.ErrorHandlers.lambda$handleError$1(ErrorHandlers.java:181)
	at java.base/java.util.Optional.ifPresentOrElse(Optional.java:198)
	at io.helidon.nima.webserver.http.ErrorHandlers.handleError(ErrorHandlers.java:180)
	at io.helidon.nima.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:118)
	at io.helidon.nima.webserver.http.Filters.filter(Filters.java:77)
	at io.helidon.nima.webserver.http.HttpRouting.route(HttpRouting.java:107)
	at io.helidon.nima.http2.webserver.Http2Stream.handle(Http2Stream.java:383)
	at io.helidon.nima.http2.webserver.Http2Stream.run(Http2Stream.java:265)
	at io.helidon.nima.http2.webserver.Http2Connection$StreamRunnable.run(Http2Connection.java:783)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
	at java.base/java.util.concurrent.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:352)
	at java.base/java.lang.VirtualThread.run(VirtualThread.java:305)
	at java.base/java.lang.VirtualThread$VThreadContinuation.lambda$new$0(VirtualThread.java:177)
	at java.base/jdk.internal.vm.Continuation.enter0(Continuation.java:327)
	at java.base/jdk.internal.vm.Continuation.enter(Continuation.java:320)
Caused by: java.lang.RuntimeException: java.io.UncheckedIOException: java.net.SocketException: Socket closed
	at io.helidon.nima.http2.Http2ConnectionWriter.withStreamLock(Http2ConnectionWriter.java:157)
	at io.helidon.nima.http2.Http2ConnectionWriter.writeHeaders(Http2ConnectionWriter.java:104)
	at io.helidon.nima.http2.webserver.Http2ServerResponse.send(Http2ServerResponse.java:107)
	at io.helidon.nima.tests.integration.http2.webserver.CutConnectionTest.plainText(CutConnectionTest.java:84)
	at io.helidon.nima.webserver.http.HttpRouting$RoutingExecutor.doRoute(HttpRouting.java:549)
	at io.helidon.nima.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:508)
	at io.helidon.nima.webserver.http.HttpRouting$RoutingExecutor.call(HttpRouting.java:486)
	at io.helidon.nima.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
	... 11 more
Caused by: java.io.UncheckedIOException: java.net.SocketException: Socket closed
	at io.helidon.common.buffers.FixedBufferData.writeTo(FixedBufferData.java:74)
	at io.helidon.common.buffers.CompositeArrayBufferData.writeTo(CompositeArrayBufferData.java:41)
	at io.helidon.common.socket.PlainSocket.write(PlainSocket.java:127)
	at io.helidon.common.socket.SocketWriter.writeNow(SocketWriter.java:67)
	at io.helidon.common.socket.SocketWriterDirect.write(SocketWriterDirect.java:43)
	at io.helidon.nima.http2.Http2ConnectionWriter.noLockWrite(Http2ConnectionWriter.java:173)
	at io.helidon.nima.http2.Http2ConnectionWriter.lambda$writeHeaders$1(Http2ConnectionWriter.java:117)
	at io.helidon.nima.http2.Http2ConnectionWriter.withStreamLock(Http2ConnectionWriter.java:150)
	... 18 more
Caused by: java.net.SocketException: Socket closed
	at java.base/sun.nio.ch.NioSocketImpl.ensureOpenAndConnected(NioSocketImpl.java:163)
	at java.base/sun.nio.ch.NioSocketImpl.beginWrite(NioSocketImpl.java:356)
	at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:401)
	at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:433)
	at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:812)
	at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1120)
	at io.helidon.common.buffers.FixedBufferData.writeTo(FixedBufferData.java:71)
	... 25 more
@danielkec danielkec changed the title Nima HTTP/2 Nima HTTP/2 - Writing to closed socket error May 22, 2023
@danielkec danielkec self-assigned this May 22, 2023
@danielkec danielkec added Níma Helidon Níma 4.x Version 4.x labels May 22, 2023
@danielkec danielkec added bug Something isn't working P2 labels May 23, 2023
@danielkec danielkec linked a pull request Jun 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x bug Something isn't working Níma Helidon Níma P2
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant