-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8339356: Test javax/net/ssl/SSLSocket/Tls13PacketSize.java failed with java.net.SocketException: An established connection was aborted by the software in your host machine #22591
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
Conversation
…h java.net.SocketException: An established connection was aborted by the software in your host machine
|
👋 Welcome back mdonovan! A progress list of the required criteria for merging this PR into |
|
@mpdonova 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 261 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. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
|
|
||
| sslOS.write(appData); | ||
| sslOS.flush(); | ||
| sslIS.read(); |
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.
The failure is caused by closing the socket before all the data sent by the client is read. In order to read all the data, you need something like:
| sslIS.read(); | |
| sslIS.read(appData, 1, appData.length-1); |
The failure is hard to reproduce. You might need to repeat the test a few hundred times to see if it's gone. And it only affects Windows.
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.
I ran the test many hundreds of times and didn't see the error. I updated the code as you suggested and ran it 100s of times again without reproducing it.
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.
FWIW, here's a diff that reliably reproduces the issue:
diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java
index a7809754ed0..b57f1665408 100644
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java
@@ -358,6 +358,13 @@ void deliver(byte[] source, int offset, int length) throws IOException {
}
offset += fragLen;
+ if (offset < limit && tc.sslConfig.isClientMode) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ //throw new RuntimeException(e);
+ }
+ }
}
} finally {
recordLock.unlock();
pretty typical for reproducing race conditions, it adds a delay on the right path.
Just verified, the PR doesn't fix the failure. Probably because the call to read returns whatever data is available immediately, and doesn't wait for more data to become available.
EDIT: corrected the diff
|
|
||
| sslOS.write(appData); | ||
| sslOS.flush(); | ||
| sslIS.read(appData, 1, appData.length-1); |
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.
| sslIS.read(appData, 1, appData.length-1); | |
| int drained = 1; | |
| while (drained < appData.length) { | |
| drained += sslIS.read(appData, drained, appData.length - drained); | |
| } |
this one actually works, I checked.
djelinski
left a comment
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.
|
/contributor add @djelinski |
|
@mpdonova |
|
/integrate |
|
Going to push as commit f6e7713.
Your commit was automatically rebased without conflicts. |
I was unable to reproduce the error but I suspect the error is caused by the server-side closing the socket as soon as the write operation is done. I added a read() call on the server to ensure the client initiates connection close
Progress
Issue
Reviewers
Contributors
<djelinski@openjdk.org>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22591/head:pull/22591$ git checkout pull/22591Update a local copy of the PR:
$ git checkout pull/22591$ git pull https://git.openjdk.org/jdk.git pull/22591/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22591View PR using the GUI difftool:
$ git pr show -t 22591Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22591.diff
Using Webrev
Link to Webrev Comment