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

8303481: CancelRequestTest assertTrue failing with AssertionError due to java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading #12850

Closed
wants to merge 4 commits into from

Conversation

dfuch
Copy link
Member

@dfuch dfuch commented Mar 3, 2023

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@3564a02c]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 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8303481: CancelRequestTest assertTrue failing with AssertionError due to java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12850/head:pull/12850
$ git checkout pull/12850

Update a local copy of the PR:
$ git checkout pull/12850
$ git pull https://git.openjdk.org/jdk pull/12850/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12850

View PR using the GUI difftool:
$ git pr show -t 12850

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12850.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 3, 2023

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 8303481 8303481: CancelRequestTest assertTrue failing with AssertionError due to java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading Mar 3, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 3, 2023
@openjdk
Copy link

openjdk bot commented Mar 3, 2023

@dfuch The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Mar 3, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 3, 2023

Webrevs

@jaikiran
Copy link
Member

jaikiran commented Mar 3, 2023

The changes look fine to me. The OutgoingHeaders file will need a copyright year update.

@openjdk
Copy link

openjdk bot commented Mar 3, 2023

@dfuch This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: jpai, djelinski

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 3 new commits pushed to the master branch:

  • d23a8bf: 8297753: AArch64: Add optimized rules for vector compare with zero on NEON
  • 339ca88: 8303539: javadoc typos in Attr
  • e1745bc: 8303473: Add implied {@code} in java.lang.invoke.MethodHandles

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 3, 2023
…/Queue.java


Add Objects.requireNonNull(obj);
@djelinski
Copy link
Member

could you make put call putIfOpen? It would reduce the amount of duplicated code.

@dfuch
Copy link
Member Author

dfuch commented Mar 3, 2023

could you make put call putIfOpen? It would reduce the amount of duplicated code.

Excellent idea. Done.

@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 3, 2023
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 3, 2023
@dfuch
Copy link
Member Author

dfuch commented Mar 3, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Mar 3, 2023

Going to push as commit cbdc7a6.
Since your change was applied there have been 6 commits pushed to the master branch:

  • 8bf084c: 8303499: [s390x] ProblemList StressStackOverflow
  • ff364c1: 8301622: ProcessTools.java compilation gets ThreadDeath deprecation warning
  • df9aad0: 8297955: LDAP CertStore should use LdapName and not String for DNs
  • d23a8bf: 8297753: AArch64: Add optimized rules for vector compare with zero on NEON
  • 339ca88: 8303539: javadoc typos in Attr
  • e1745bc: 8303473: Add implied {@code} in java.lang.invoke.MethodHandles

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 3, 2023
@openjdk openjdk bot closed this Mar 3, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 3, 2023
@openjdk
Copy link

openjdk bot commented Mar 3, 2023

@dfuch Pushed as commit cbdc7a6.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
3 participants