[java-identity-provider] branch maint-4 updated: IDP-2035 - LDAP connection pools not freeing connections when shut down

Scott Cantor cantor.2 at osu.edu
Tue Nov 8 13:22:16 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch maint-4
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=5efcaf5300d8a4e0063b24bf33f486b6e40c75ed

The following commit(s) were added to refs/heads/maint-4 by this push:
     new 5efcaf530 IDP-2035 - LDAP connection pools not freeing connections when shut down
5efcaf530 is described below

commit 5efcaf5300d8a4e0063b24bf33f486b6e40c75ed
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 8 08:22:13 2022 -0500

    IDP-2035 - LDAP connection pools not freeing connections when shut down
    
    https://shibboleth.atlassian.net/browse/IDP-2035
    
    Seemingly correct but non-functional patch.
---
 .../attribute/resolver/dc/ldap/impl/LDAPDataConnector.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/LDAPDataConnector.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/LDAPDataConnector.java
index 68b829ff0..60eee60c7 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/LDAPDataConnector.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/LDAPDataConnector.java
@@ -29,6 +29,8 @@ import org.ldaptive.ConnectionFactory;
 import org.ldaptive.LdapException;
 import org.ldaptive.SearchExecutor;
 import org.ldaptive.SearchResult;
+import org.ldaptive.pool.ConnectionPool;
+import org.ldaptive.pool.PooledConnectionFactory;
 import org.ldaptive.ssl.SSLContextInitializer;
 import org.ldaptive.ssl.SslConfig;
 import org.ldaptive.ssl.X509SSLContextInitializer;
@@ -159,6 +161,18 @@ public class LDAPDataConnector extends AbstractSearchDataConnector<ExecutableSea
         }
         policeForJVMTrust();
     }
+    
+    /** {@inheritDoc} */
+    @Override protected void doDestroy() {
+        if (connectionFactory instanceof PooledConnectionFactory) {
+            final ConnectionPool pool = ((PooledConnectionFactory) connectionFactory).getConnectionPool();
+            if (pool != null) {
+                log.info("{} Closing LDAP connection pool", getLogPrefix());
+                pool.close();
+            }
+        }
+        super.doDestroy();
+    }
 
 // CheckStyle: CyclomaticComplexity OFF
     /** Police TLS for JVM trust.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list