RFR: 8314063 : The socket is not closed in Connection::createSocket when the handshake failed for LDAP connection [v2]
Mark Sheppard
msheppar at openjdk.org
Wed Aug 16 22:52:45 UTC 2023
On Wed, 16 Aug 2023 19:12:54 GMT, Weibing Xiao <duke at openjdk.org> wrote:
>> Please refer to JDK-8314063.
>>
>> The failure scenario is due to the setting of connection timeout. It is either too small or not an optimal value for the system. When the client tries to connect to the server with LDAPs protocol. It requires the handshake after the socket is created and connected, but it fails due to connection timeout and leaves the socket open. It is not closed properly due to the exception handling in the JDK code.
>>
>> The change is adding a try/catch block and closing the socket in the catch block, and the format of the code got changed consequently.
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>
> update the test code
test/jdk/com/sun/jndi/ldap/LdapSSLHandshakeFailureTest.java line 173:
> 171: public void run() {
> 172: try (Socket socket = serverSocket.accept()) {
> 173: Thread.sleep(10000);
What's the purpose of the sleep ?
Regardless, based on the test semantics alluded in the test name, the server should never enter the read block. So is this code redundant? Or is it there just in case the accept and the handshake succeeds?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15294#discussion_r1296511511
More information about the core-libs-dev
mailing list