directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1748755 - /directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Date Thu, 16 Jun 2016 16:18:36 GMT
Author: elecharny
Date: Thu Jun 16 16:18:35 2016
New Revision: 1748755

URL: http://svn.apache.org/viewvc?rev=1748755&view=rev
Log:
Fixed an infinite loop that led to an exhaustion of the file handler on the system (too many
open files). Cleanup is good, too much cleanup is wrong ;-)

Modified:
    directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1748755&r1=1748754&r2=1748755&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/branches/shared-value/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Thu Jun 16 16:18:35 2016
@@ -567,7 +567,7 @@ public class LdapNetworkConnection exten
         timeout = config.getTimeout();
         long maxRetry = System.currentTimeMillis() + timeout;
         ConnectFuture connectionFuture = null;
-
+        
         while ( maxRetry > System.currentTimeMillis() )
         {
             connectionFuture = connector.connect( address );
@@ -604,6 +604,9 @@ public class LdapNetworkConnection exten
                             // No need to wait
                             // We know that there was a permanent error such as "connection
refused".
                             LOG.debug( "------>> Connection error: {}", connectionFuture.getException().getMessage()
);
+                            
+                            // We can quit the loop
+                            break;
                         }
 
                         LOG.debug( "------>>   Cannot get the connection... Retrying"
);
@@ -622,6 +625,11 @@ public class LdapNetworkConnection exten
                             throw new LdapOtherException( e.getMessage(), e );
                         }
                     }
+                    else
+                    {
+                        // We can quit the loop
+                        break;
+                    }
                 }
             }
         }
@@ -1080,7 +1088,7 @@ public class LdapNetworkConnection exten
      * {@inheritDoc}
      */
     @Override
-public BindFuture bindAsync() throws LdapException
+    public BindFuture bindAsync() throws LdapException
     {
         LOG.debug( "Asynchronous Bind request" );
 



Mime
View raw message