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

8286962: java/net/httpclient/ServerCloseTest.java failed once with ConnectException #9155

Closed
wants to merge 2 commits into from

Conversation

c-cleary
Copy link
Contributor

@c-cleary c-cleary commented Jun 14, 2022

Issue
A failure in this test was observed whereby an unexpected connection from a client that was not created by the test caused the test to unsucessfully complete.

Solution
When a connection is accepted by the ServerSocket, some verification of the Request URI and of the Request Path is conducted. If the client connection is found to be invalid or external to the test, the connection is closed. The ServerSocket will continue to accept new connections until the correct parameters are met. Once a valid connection is accepted, the test behaves exactly as it previously did.


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-8286962: java/net/httpclient/ServerCloseTest.java failed once with ConnectException

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9155

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 14, 2022

👋 Welcome back ccleary! 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
Copy link

openjdk bot commented Jun 14, 2022

@c-cleary 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 Jun 14, 2022
@c-cleary c-cleary marked this pull request as ready for review June 14, 2022 15:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 14, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 14, 2022

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Thanks for the fix Conor! I have suggested some changes that should make the fix easier to review and keep it closer to the original.

String method = tokenizer.nextToken();
assert method.equalsIgnoreCase("POST")
|| method.equalsIgnoreCase("GET");
tokenizer.nextToken(); // Skip method token as not used
Copy link
Member

Choose a reason for hiding this comment

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

Since we were asserting here before, maybe we could directly close the clientConnection here if method is not GET or POST.

Something like:

if (!"GET".equals(method) && !POST.equals(method)) {
   System.out.println(now() + getName() + ": Unexpected method: " + method);
   clientConnection.close();
   continue;
}

String path = tokenizer.nextToken();
URI uri;

Copy link
Member

Choose a reason for hiding this comment

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

We should check path immediately before trying to build the URI. If it doesn't contain what we expect, then close the clientConnection and continue as suggested above.

System.out.println(now() + getName() + ": Reading header: "
+ (line = readLine(ccis)));
headers.append(line).append("\r\n");
validURI = false;
Copy link
Member

Choose a reason for hiding this comment

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

maybe just leave that as before?

+ ": received body: "
+ new String(ccis.readNBytes(len), UTF_8));
// Proceed if URI is well-formed and the request path is as expected
if (validURI && path.contains("/dummy/x")) {
Copy link
Member

Choose a reason for hiding this comment

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

Since we will have already checked path, method and uri here just unconditionally add the clientConnection to the list and proceed as before.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

LGTM. Please make sure the test is stable before integrating, and then drop me a note, and I will sponsor.

@openjdk
Copy link

openjdk bot commented Jun 15, 2022

@c-cleary 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:

8286962: java/net/httpclient/ServerCloseTest.java failed once with ConnectException

Reviewed-by: dfuchs, jpai

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

  • 6633855: 8288399: MacOS debug symbol files not always deterministic in reproducible builds
  • d5cd2f2: 8284849: Add deoptimization to unified logging
  • dfeeb6f: 8288140: Avoid redundant Hashtable.get call in Signal.handle
  • 68b2057: 8287373: remove unnecessary paddings in generated code
  • 2471f8f: 8287647: VM debug support: find node by pattern in name or dump
  • 33f34d5: 8288207: Enhance MalformedURLException in Uri.parseCompat
  • 444a0d9: 8284977: MetricsTesterCgroupV2.getLongValueEntryFromFile fails when named value doesn't exist
  • 08400f1: 8287349: AArch64: Merge LDR instructions to improve C1 OSR performance
  • fe80721: 8287917: System.loadLibrary does not work on Big Sur if JDK is built with macOS SDK 10.15 and earlier
  • bbaeacb: 8265586: [windows] last button is not shown in AWT Frame with BorderLayout and MenuBar set.
  • ... and 276 more: https://git.openjdk.org/jdk/compare/f58c9a659ba181407ecdb2aacb81e6a7f1cbd9ff...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch, @jaikiran) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 15, 2022
@c-cleary
Copy link
Contributor Author

Test appears stable after multiple runs and tier runs. Issuing integration command

@c-cleary
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jun 15, 2022
@openjdk
Copy link

openjdk bot commented Jun 15, 2022

@c-cleary
Your change (at version f0de213) is now ready to be sponsored by a Committer.

@dfuch
Copy link
Member

dfuch commented Jun 15, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Jun 15, 2022

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

  • 6633855: 8288399: MacOS debug symbol files not always deterministic in reproducible builds
  • d5cd2f2: 8284849: Add deoptimization to unified logging
  • dfeeb6f: 8288140: Avoid redundant Hashtable.get call in Signal.handle
  • 68b2057: 8287373: remove unnecessary paddings in generated code
  • 2471f8f: 8287647: VM debug support: find node by pattern in name or dump
  • 33f34d5: 8288207: Enhance MalformedURLException in Uri.parseCompat
  • 444a0d9: 8284977: MetricsTesterCgroupV2.getLongValueEntryFromFile fails when named value doesn't exist
  • 08400f1: 8287349: AArch64: Merge LDR instructions to improve C1 OSR performance
  • fe80721: 8287917: System.loadLibrary does not work on Big Sur if JDK is built with macOS SDK 10.15 and earlier
  • bbaeacb: 8265586: [windows] last button is not shown in AWT Frame with BorderLayout and MenuBar set.
  • ... and 276 more: https://git.openjdk.org/jdk/compare/f58c9a659ba181407ecdb2aacb81e6a7f1cbd9ff...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 15, 2022

@dfuch @c-cleary Pushed as commit 13d4ddc.

💡 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