Skip to content
Permalink
Browse files
8274736: Concurrent read/close of SSLSockets causes SSLSessions to be…
… invalidated unnecessarily

Reviewed-by: xuelei, wetmore
  • Loading branch information
Jamil Nimeh committed Nov 10, 2021
1 parent c1e41fe commit 8822d41fdcc2c2d568badd72635dc587d21dbd63
@@ -26,6 +26,7 @@
package sun.security.ssl;

import java.io.IOException;
import java.net.SocketException;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -383,7 +384,12 @@ SSLException fatal(Alert alert, String diagnostic,

// invalidate the session
if (conSession != null) {
conSession.invalidate();
// In the case of a low-layer transport error, we want to prevent
// the session from being invalidated since this is not a TLS-level
// error event.
if (!(cause instanceof SocketException)) {
conSession.invalidate();
}
}

if (handshakeContext != null &&
@@ -210,12 +210,12 @@ protected void configureServerSocket(SSLServerSocket socket) {
/*
* Is the server ready to serve?
*/
private final CountDownLatch serverCondition = new CountDownLatch(1);
protected final CountDownLatch serverCondition = new CountDownLatch(1);

/*
* Is the client ready to handshake?
*/
private final CountDownLatch clientCondition = new CountDownLatch(1);
protected final CountDownLatch clientCondition = new CountDownLatch(1);

/*
* What's the server port? Use any free port by default
@@ -482,7 +482,15 @@ public static SSLContext createSSLContext(
* Both sides can throw exceptions, but do you have a preference
* as to which side should be the main thread.
*/
private static final boolean separateServerThread = false;
private final boolean separateServerThread;

public SSLSocketTemplate() {
this(false);
}

public SSLSocketTemplate(boolean sepSrvThread) {
this.separateServerThread = sepSrvThread;
}

/*
* Boot up the testing, used to drive remainder of the test.

1 comment on commit 8822d41

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 8822d41 Nov 10, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.