Details
-
Bug
-
Resolution: Fixed
-
P4
-
openjdk8u332, 11.0.15, 17.0.3, 20, 21
-
b14
Description
The method SSLSocketImpl::closeSocket has the below code snippet,
if (appInput.readLock.tryLock()) {
int soTimeout = getSoTimeout();
try {
// deplete could hang on the skip operation
// in case of infinite socket read timeout.
// Change read timeout to avoid deadlock.
// This workaround could be replaced later
// with the right synchronization
if (soTimeout == 0)
setSoTimeout(DEFAULT_SKIP_TIMEOUT);
inputRecord.deplete(false);
} catch (java.net.SocketTimeoutException stEx) {
// skip timeout exception during deplete
} finally {
if (soTimeout == 0)
setSoTimeout(soTimeout);
appInput.readLock.unlock();
}
}
If getSoTimeout() throws an exception, say SocketException, appInput.readLock.unlock() cannot be called.
if (appInput.readLock.tryLock()) {
int soTimeout = getSoTimeout();
try {
// deplete could hang on the skip operation
// in case of infinite socket read timeout.
// Change read timeout to avoid deadlock.
// This workaround could be replaced later
// with the right synchronization
if (soTimeout == 0)
setSoTimeout(DEFAULT_SKIP_TIMEOUT);
inputRecord.deplete(false);
} catch (java.net.SocketTimeoutException stEx) {
// skip timeout exception during deplete
} finally {
if (soTimeout == 0)
setSoTimeout(soTimeout);
appInput.readLock.unlock();
}
}
If getSoTimeout() throws an exception, say SocketException, appInput.readLock.unlock() cannot be called.
Attachments
Issue Links
- relates to
-
JDK-8274524 SSLSocket.close() hangs if it is called during the ssl handshake
- Closed