aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Prajwal Kumaraswamy <pkumaraswamy@openjdk.org> 2021-03-25 03:35:49 +0000
committerGravatar Xue-Lei Andrew Fan <xuelei@openjdk.org> 2021-03-25 03:35:49 +0000
commit415553325831b79a7e55071f6bd7c73eb1a636ec (patch)
tree3e7e8569175c2e9ca95a6dc2532bf22a9e5c7e5c
parent3e18330a33386f48e691d358a73521e23ef0618d (diff)
downloadjdk-415553325831b79a7e55071f6bd7c73eb1a636ec.tar.gz
jdk-415553325831b79a7e55071f6bd7c73eb1a636ec.zip
8258753: StartTlsResponse.close() hangs due to synchronization issues
Reviewed-by: xuelei
-rw-r--r--src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
index 9bbe0f56a93..95c77c98f67 100644
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
@@ -1803,17 +1803,23 @@ public final class SSLSocketImpl
SSLLogger.fine("wait for close_notify or alert");
}
- while (!conContext.isInboundClosed()) {
- try {
- Plaintext plainText = decode(null);
- // discard and continue
- if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
- SSLLogger.finest(
- "discard plaintext while waiting for close", plainText);
+ appInput.readLock.lock();
+ try {
+ while (!conContext.isInboundClosed()) {
+ try {
+ Plaintext plainText = decode(null);
+ // discard and continue
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+ SSLLogger.finest(
+ "discard plaintext while waiting for close",
+ plainText);
+ }
+ } catch (Exception e) { // including RuntimeException
+ handleException(e);
}
- } catch (Exception e) { // including RuntimeException
- handleException(e);
}
+ } finally {
+ appInput.readLock.unlock();
}
}
}