-
Bug
-
Resolution: Fixed
-
P4
-
21
-
b13
-
Verified
The CancelRequestTest has been observed failing intermittently with this exception:
Got expected exception: java.util.concurrent.ExecutionException: java.io.EOFException: EOF reached while reading
cancelled jdk.internal.net.http.common.MinimalFuture@3564a02c[Completed exceptionally: java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading] (id=6669)
test CancelRequestTest.testPostSendAsync("http://localhost:49317/http2/x/same/interrupt", true, true): failure
java.lang.AssertionError: expected [true] but found [false]
at org.testng.Assert.fail(Assert.java:99)
at org.testng.Assert.failNotEquals(Assert.java:1037)
at org.testng.Assert.assertTrue(Assert.java:45)
at org.testng.Assert.assertTrue(Assert.java:55)
at CancelRequestTest.testPostSendAsync(CancelRequestTest.java:453)
Analysis of the logs shows that this is due to the Http2TestServer closing the associated connection after failing to queue up a frame for the stream in its connection readLoop. The frame could not be queued because the stream was already closed.
DEBUG: [pool-1-thread-4] [10s 773ms] Http2Connection(SocketTube(19)) Closed stream 27
Sent response headers 200
DEBUG: [readLoop] [10s 773ms] FramesDecoder decodes: 9
DEBUG: [readLoop] [10s 773ms] FramesDecoder Tail size is now: 0, current=
DEBUG: [readLoop] [10s 773ms] FramesDecoder Got frame: DATA: length=0, streamid=27, flags=END_STREAM
DEBUG: [readLoop] [10s 773ms] FramesDecoder decodes: 0
DEBUG: [readLoop] [10s 773ms] FramesDecoder Tail size is now: 0, current=
java.io.IOException: closed
at jdk.httpclient.test.lib.http2.BodyOutputStream.write(BodyOutputStream.java:84)
at java.base/java.io.OutputStream.write(OutputStream.java:124)
at CancelRequestTest$HTTPSlowHandler.handle(CancelRequestTest.java:676)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpChain$Http2Chain.doFilter(HttpServerAdapters.java:476)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestServer$Http2TestContext.handle(HttpServerAdapters.java:746)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestHandler.doHandle(HttpServerAdapters.java:395)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestHandler.lambda$toHttp2Handler$1(HttpServerAdapters.java:382)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.handleRequest(Http2TestServerConnection.java:721)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.lambda$createStream$4(Http2TestServerConnection.java:671)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Http server reader thread shutdown
java.io.IOException: stream closed
at jdk.httpclient.test.lib.http2.Queue.put(Queue.java:64)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.readLoop(Http2TestServerConnection.java:833)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection$ConnectionThread.run(Http2TestServerConnection.java:466)
The readLoop should be more robust to asynchronous closing of HTTP/2 stream, and just drop the frame if the stream is already closed.
Got expected exception: java.util.concurrent.ExecutionException: java.io.EOFException: EOF reached while reading
cancelled jdk.internal.net.http.common.MinimalFuture@3564a02c[Completed exceptionally: java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading] (id=6669)
test CancelRequestTest.testPostSendAsync("http://localhost:49317/http2/x/same/interrupt", true, true): failure
java.lang.AssertionError: expected [true] but found [false]
at org.testng.Assert.fail(Assert.java:99)
at org.testng.Assert.failNotEquals(Assert.java:1037)
at org.testng.Assert.assertTrue(Assert.java:45)
at org.testng.Assert.assertTrue(Assert.java:55)
at CancelRequestTest.testPostSendAsync(CancelRequestTest.java:453)
Analysis of the logs shows that this is due to the Http2TestServer closing the associated connection after failing to queue up a frame for the stream in its connection readLoop. The frame could not be queued because the stream was already closed.
DEBUG: [pool-1-thread-4] [10s 773ms] Http2Connection(SocketTube(19)) Closed stream 27
Sent response headers 200
DEBUG: [readLoop] [10s 773ms] FramesDecoder decodes: 9
DEBUG: [readLoop] [10s 773ms] FramesDecoder Tail size is now: 0, current=
DEBUG: [readLoop] [10s 773ms] FramesDecoder Got frame: DATA: length=0, streamid=27, flags=END_STREAM
DEBUG: [readLoop] [10s 773ms] FramesDecoder decodes: 0
DEBUG: [readLoop] [10s 773ms] FramesDecoder Tail size is now: 0, current=
java.io.IOException: closed
at jdk.httpclient.test.lib.http2.BodyOutputStream.write(BodyOutputStream.java:84)
at java.base/java.io.OutputStream.write(OutputStream.java:124)
at CancelRequestTest$HTTPSlowHandler.handle(CancelRequestTest.java:676)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpChain$Http2Chain.doFilter(HttpServerAdapters.java:476)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestServer$Http2TestContext.handle(HttpServerAdapters.java:746)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestHandler.doHandle(HttpServerAdapters.java:395)
at jdk.httpclient.test.lib.common.HttpServerAdapters$HttpTestHandler.lambda$toHttp2Handler$1(HttpServerAdapters.java:382)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.handleRequest(Http2TestServerConnection.java:721)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.lambda$createStream$4(Http2TestServerConnection.java:671)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Http server reader thread shutdown
java.io.IOException: stream closed
at jdk.httpclient.test.lib.http2.Queue.put(Queue.java:64)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection.readLoop(Http2TestServerConnection.java:833)
at jdk.httpclient.test.lib.http2.Http2TestServerConnection$ConnectionThread.run(Http2TestServerConnection.java:466)
The readLoop should be more robust to asynchronous closing of HTTP/2 stream, and just drop the frame if the stream is already closed.