Skip to content

8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade#14251

Closed
dfuch wants to merge 3 commits intoopenjdk:masterfrom
dfuch:ExecutorShutdown-ConnectionAborter-8309200
Closed

8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade#14251
dfuch wants to merge 3 commits intoopenjdk:masterfrom
dfuch:ExecutorShutdown-ConnectionAborter-8309200

Conversation

@dfuch
Copy link
Member

@dfuch dfuch commented May 31, 2023

The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the ConnectionAborter class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic IOException: connection closed locally is raised at the SocketTube level, which unfortunately can race with the original cause.

The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception.


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-8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14251

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 31, 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 8309200 8309200: java/net/httpclient/ExecutorShutdown fais intermittently, if connection closed during upgrade May 31, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label May 31, 2023
@openjdk
Copy link

openjdk bot commented May 31, 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 May 31, 2023
@mlbridge
Copy link

mlbridge bot commented May 31, 2023

Webrevs

HttpConnection connection;
Throwable cause;
synchronized (this) {
if ((cause = this.cause) == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's extract the assignment to a separate statement. Code is a bit hard to read.

closeRequested = true;
} else {
this.connection = null;
this.cause = null;
Copy link
Member

@jaikiran jaikiran Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Daniel, I had to read this a few times to understand why we are resetting this.cause, which we potentially set a few lines above, to null here. From what I understand, we only want to set this.cause when the connection is null. Do you think this code could instead of written as:

Throwable cause;
synchronized (this) {
 cause = this.cause;
 if (cause == null) {
     cause = error;
 }
 connection = this.connection;
 if (connection == null) {
     closeRequested = true;
     this.cause = cause;
 } else {
     this.connection = null;
     this.cause = null;
 }
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better yes. I'll steal it!

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look fine to me. I have a minor comment about the code in the ConnectionAborter, which I've added inline. It's OK with me if you prefer to maintain it in its current form in the PR.

@openjdk
Copy link

openjdk bot commented Jun 2, 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:

8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade

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 45 new commits pushed to the master branch:

  • dc8bc6c: 8308090: Add container tests for on-the-fly resource quota updates
  • 73e7af9: 8309287: Add fontconfig requirement to building.md for Debian
  • aeb53e6: 8308711: Develop additional Tests for KEM implementation
  • dcd9590: 8309224: Fix xlc17 clang 15 warnings in java.desktop
  • 8f1ce78: 8308752: Generational ZGC: Avoid final marking through stack chunks
  • 7b0a336: 8308387: CLD created and unloading list sharing _next node pointer leads to concurrent YC missing CLD roots
  • 60f3b87: 8309295: C2: MaxNode::signed_min() returns nullptr for int operands
  • 8007599: 8309093: Underscore with brackets
  • 5bd2af2: 8307478: Implementation of Prepare to Restrict The Dynamic Loading of Agents
  • 325940b: 8307105: JFileChooser InvalidPathException when selecting some system folders on Windows
  • ... and 35 more: https://git.openjdk.org/jdk/compare/4aea7dab152de4c61724eec9a40024c990f8dabc...master

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 Jun 2, 2023
@dfuch dfuch changed the title 8309200: java/net/httpclient/ExecutorShutdown fais intermittently, if connection closed during upgrade 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade Jun 2, 2023
Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Daniel for the update. Looks good to me.

@dfuch
Copy link
Member Author

dfuch commented Jun 2, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jun 2, 2023

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 2, 2023

@dfuch Pushed as commit 931913f.

💡 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

Development

Successfully merging this pull request may close these issues.

4 participants