Brandon:
After Working with my fw-admin here, He fixed that problem (tcp connections being timed out) quite a while ago.  We did not experience that for a while.  Now, it was resurfacing again.  So, I downloaded the source code from http://www.dahbura.com/ldap/, who is the original author of the ConnectionPool: the code you download from his source has some other functions such as refreshing your pool after periodic interval.  I set this interval to be every 3 hrs, and I found that some of those unused connections go dead and they get refreshed.
However, you can check right before giving the connection object whether it is connected or not by adding the following code segment inside the function "protected LDAPConnection getConnFromPool()":

        if ( ldapconnobj != null )
        {
            con = ldapconnobj.getLDAPConn();

            /*start->Added segment*******************/
            if ( !con.isConnected() )
            {
                System.out.println ( "connection (while retrieving connection) is not connected, attempting reconnect before handoff." );
                try {
                    con.reconnect();
                    //reset the ldapconnobj's LDAPConnection parameter
                    ldapconnobj.setLDAPConn( con );
                    //reset the pool's ldapconnobj parameter
                    pool.set( i,ldapconnobj );
                } catch (LDAPException e) {
                        debug("Unable to reconnect - server is probably down");
                }
                System.out.println( "reconnect succeeded." );
            }
            /*end->Added segment*******************/
        }
           
This will reconnect right before
Right now, I am still working with my fw-admin on finding out why some of those connections get disconnected every now and then.

On 10/24/05, Brandon Keepers <[EMAIL PROTECTED]> wrote:
Sudip,

On Mon, 2005-10-24 at 08:45 -0500, sudip shrestha wrote:
> I am using netscape.ldap.util.ConnectionPool and found that after a
> while tomcat (5.5.7) server would stop responding to any pages/actions
> that have to deal with ldap functions...can't even do printPool().  I
> checked all other stuffs regarding the website, any other pages or
> actions regarding the datbase or other stuffs work just fine, it is
> just the ldap related pages such as login...which would just seem to
> get hung up...
> If anybody has any experience using this ConnectionPool in production
> environment, please let me know. Any suggestions would be helpful.

We recently moved our LDAP servers behind a firewall and began
experiencing similar behavior.  The problem ended up being caused by the
firewall timing out TCP connections after an hour of inactivity.  The
pool would try to reuse the closed connections, giving us the same
behavior you described.  We just disabled the TCP timouts on the
firewall, because it was also conflicting with the database connection
pools.

Brandon


Reply via email to