Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.
/ jdk16u Public archive

Commit 484087b

Browse files
Prajwal Kumaraswamycoffeys
Prajwal Kumaraswamy
authored andcommitted
8258753: StartTlsResponse.close() hangs due to synchronization issues
Reviewed-by: coffeys
1 parent 5375fda commit 484087b

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1784,17 +1784,23 @@ private void waitForClose() throws IOException {
17841784
SSLLogger.fine("wait for close_notify or alert");
17851785
}
17861786

1787-
while (!conContext.isInboundClosed()) {
1788-
try {
1789-
Plaintext plainText = decode(null);
1790-
// discard and continue
1791-
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
1792-
SSLLogger.finest(
1793-
"discard plaintext while waiting for close", plainText);
1787+
appInput.readLock.lock();
1788+
try {
1789+
while (!conContext.isInboundClosed()) {
1790+
try {
1791+
Plaintext plainText = decode(null);
1792+
// discard and continue
1793+
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
1794+
SSLLogger.finest(
1795+
"discard plaintext while waiting for close",
1796+
plainText);
1797+
}
1798+
} catch (Exception e) { // including RuntimeException
1799+
handleException(e);
17941800
}
1795-
} catch (Exception e) { // including RuntimeException
1796-
handleException(e);
17971801
}
1802+
} finally {
1803+
appInput.readLock.unlock();
17981804
}
17991805
}
18001806
}

0 commit comments

Comments
 (0)