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
Conversation
👋 Welcome back ccleary! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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")) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
@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:
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
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 |
Test appears stable after multiple runs and tier runs. Issuing integration command |
/integrate |
/sponsor |
Going to push as commit 13d4ddc.
Your commit was automatically rebased without conflicts. |
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
Issue
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