directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <zapletal-mar...@email.cz>
Subject Ldap persistent connection pool issues
Date Mon, 13 Oct 2014 19:45:36 GMT
Hello,



we are building a service using Apache Directory LDAP API. It should be a 
long running service so it should manage the LDAP connection properly to 
avoid disconnects or other issues after being up for a long time.




The code we are using looks roughly like this




Initialization:





    LdapConnectionConfig config = new LdapConnectionConfig()

    config.setLdapHost(...)

    config.setLdapPort(...)

    config.setName(...)

    config.setCredentials(...)




    connectionPool = new LdapConnectionPool(new 
PoolableLdapConnectionFactory(config))

    connectionPool.setTestOnBorrow(true)

    connectionPool.setTestOnReturn(true)





On each request





      LdapConnection connection = connectionPool.getConnection()

      connection.setTimeOut(...)

      ... //Do search/add/delete/modify using the connection

      connectionPool.releaseConnection(connection)





We are currently trying to troubleshoot the service. Everything works fine, 
but after some time the service logs error similar to the below and stops 
working. Restart of the service fixes the issue. Therefore we suspect the 
long running nature of the service and we believe we may be using the 
connection pool incorrectly (e.g. not releasing the connection correctly)





ERROR[ForkJoinPool-2-worker-3] PoolableLdapConnectionFactory - unable to 
unbind connection: Cannot connect on the server, the connection is invalid




Unfortunately it is difficult to find documentation or examples of proper 
usage of connection pool. Are we using it right or are we missing some steps
(e.g. bind, unbind, connect, ..?). Are there any examples or documentation I
could read to understand how to use the pool?




Any help appreciated,




Thanks

Martin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message