RFR: 8303481: CancelRequestTest assertTrue failing with AssertionError due to java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading [v4]

Daniel Jeliński djelinski at openjdk.org
Fri Mar 3 12:17:15 UTC 2023


On Fri, 3 Mar 2023 12:07:43 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Please find here a fix that address a robustness issue in our test HTTP/2 server.
>> 
>> Somewhat unrelated to the issue - but making the debug log easier to read - I changed the toString() of OutgoingHeaders to be more meaningful. OutgoingHeaders is a synthetic frame - the toString of the parent class was making it appear as an UNKNOWN frame - which was confusing.
>> 
>> 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 at 3564a02c]jdk.internal.net.http.common.MinimalFuture at 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 previously cancelled stream in its connection readLoop. The frame could not be queued because the previous 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.
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix trailing whitespaces

Marked as reviewed by djelinski (Committer).

-------------

PR: https://git.openjdk.org/jdk/pull/12850


More information about the net-dev mailing list