Skip to content

Commit 4155533

Browse files
Prajwal KumaraswamyXueleiFan
Prajwal Kumaraswamy
authored andcommitted
8258753: StartTlsResponse.close() hangs due to synchronization issues
Reviewed-by: xuelei
1 parent 3e18330 commit 4155533

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,17 +1803,23 @@ private void waitForClose() throws IOException {
18031803
SSLLogger.fine("wait for close_notify or alert");
18041804
}
18051805

1806-
while (!conContext.isInboundClosed()) {
1807-
try {
1808-
Plaintext plainText = decode(null);
1809-
// discard and continue
1810-
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
1811-
SSLLogger.finest(
1812-
"discard plaintext while waiting for close", plainText);
1806+
appInput.readLock.lock();
1807+
try {
1808+
while (!conContext.isInboundClosed()) {
1809+
try {
1810+
Plaintext plainText = decode(null);
1811+
// discard and continue
1812+
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
1813+
SSLLogger.finest(
1814+
"discard plaintext while waiting for close",
1815+
plainText);
1816+
}
1817+
} catch (Exception e) { // including RuntimeException
1818+
handleException(e);
18131819
}
1814-
} catch (Exception e) { // including RuntimeException
1815-
handleException(e);
18161820
}
1821+
} finally {
1822+
appInput.readLock.unlock();
18171823
}
18181824
}
18191825
}

0 commit comments

Comments
 (0)