After migrating to Spring Boot 3.2.0, operations against LDAP using Unboundid fail after a certain amount of time. This is the same code that has been functioning perfectly with Spring Boot 3.1 and Spring Boot 2.7.

I have confirmed that the same version of the unboundid library is used in all cases (6.0.10), so I am pretty sure it is not due to the version of unboundid.

First issue: When attempting to authenticate against an instance of LDAP, at some point it starts throwing the following exception.

Exception in thread "Connection reader for connection 18 to ldap-xxx.xxxx.xx:1636" java.lang.NoClassDefFoundError: com/unboundid/ldap/protocol/ProtocolMessages
    at com.unboundid.ldap.protocol.LDAPMessage.readLDAPResponseFrom(LDAPMessage.java:1217)
    at com.unboundid.ldap.sdk.LDAPConnectionReader.run(LDAPConnectionReader.java:242)
Caused by: java.lang.ClassNotFoundException: com.unboundid.ldap.protocol.ProtocolMessages
    ... 2 more

Second issue: When performing a search against an instance of LDAP, at some point it starts throwing the following exception.

Caused by: com.unboundid.ldap.sdk.LDAPSearchException: A client-side timeout was encountered while waiting 300000ms for a response to search request with message ID 541, base DN 'ou=people,o=xxx,dc=xxx,dc=xxx,dc=xx', scope SUB, and filter '(uid=geraldbconfig)' from server sit-xxx.xxx.xxx:636.
    at com.unboundid.ldap.sdk.SearchRequest.process(SearchRequest.java:1464) ~[unboundid-ldapsdk-6.0.10.jar!/:6.0.10]
    at com.unboundid.ldap.sdk.LDAPConnection.search(LDAPConnection.java:3979) ~[unboundid-ldapsdk-6.0.10.jar!/:6.0.10]
    at com.icsynergy.icamp.custom.ahs.ldap.LdapResource.search(LdapResource.java:83) ~[!/:1.0-SNAPSHOT]

Third issue: At some point, SSL fails against an instance of LDAP where it was working fine up to that point. No issues with connection, server availability, or SSL certificate.

Caused by: LDAPException(resultCode=81 (server down), numEntries=0, numReferences=0, errorMessage='An error occurred while attempting to send the LDAP message to server xxx.xxx.xxx.xx:636:  SocketException(Connection reset by peer), ldapSDKVersion=6.0.10, revision=51b3c7fe15cf42d4b2cd3bbd8165ebf759a8277d'')
    at com.unboundid.ldap.sdk.LDAPConnection.search(LDAPConnection.java:3989)
    at com.icsynergy.iib.custom.retriever.LdapAdapter.listResourceObjects(LdapAdapter.java:212)
    ... 59 more
Caused by: LDAPException(resultCode=81 (server down), errorMessage='An error occurred while attempting to send the LDAP message to server xxx.xxx.xxx:636:  SocketException(Connection reset by peer), ldapSDKVersion=6.0.10, revision=51b3c7fe15cf42d4b2cd3bbd8165ebf759a8277d')
    at com.unboundid.ldap.sdk.LDAPConnectionInternals.sendMessage(LDAPConnectionInternals.java:698)
    at com.unboundid.ldap.sdk.LDAPConnection.sendMessage(LDAPConnection.java:4688)
    at com.unboundid.ldap.sdk.SearchRequest.processAsync(SearchRequest.java:1679)
    at com.unboundid.ldap.sdk.SearchRequest.process(SearchRequest.java:1405)
    at com.unboundid.ldap.sdk.LDAPConnection.search(LDAPConnection.java:3979)
    ... 60 more
Caused by: java.net.SocketException: Connection reset by peer
    at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:420)
    at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
    at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
    at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1035)
    at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:345)
    at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1304)
    at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
    at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
    at com.unboundid.ldap.sdk.LDAPConnectionInternals.sendMessage(LDAPConnectionInternals.java:662)
    ... 64 more

Comment From: wilkinsona

The first problem is somewhat similar to https://github.com/spring-projects/spring-boot/issues/38611. It would be interesting to know if the failure occurs when using the classic loader implementation. Could you please give it a try?

The other two look like a coincidence to me. Spring Boot isn't involved at the network level.

Comment From: gboersma

I retried wth classic loader implementation, and everything looks good. I am no longer seeing those errors and some other strange things that I saw before are all gone now.

Comment From: gboersma

Refer to: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes

Looks like there are a number of issues with the new approach.

Comment From: philwebb

@gboersma We've just pushed a fix for #38611. Is it possible that you could revert back to the default loader and try the latest SNAPSHOT to see if we've also fixed your issue?

Comment From: gboersma

Looks like the fix for #38611 has fixed this issue as well. Thanks!

Comment From: philwebb

Thanks for testing it @gboersma