8274736: Concurrent read/close of SSLSockets causes SSLSessions to be invalidated unnecessarily

Reviewed-by: xuelei, wetmore
This commit is contained in:
Jamil Nimeh 2021-11-10 01:24:33 +00:00
parent c1e41fe38b
commit 8822d41fdc
3 changed files with 429 additions and 4 deletions

View file

@ -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 @@ final class TransportContext implements ConnectionContext {
// 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 &&