You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Damien Dubé (JIRA)" <ji...@apache.org> on 2012/11/15 22:35:12 UTC

[jira] [Created] (DIRAPI-96) Connection leak in LdapConnectionPool.

Damien Dubé created DIRAPI-96:
---------------------------------

             Summary: Connection leak in LdapConnectionPool.
                 Key: DIRAPI-96
                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
             Project: Directory Client API
          Issue Type: Bug
            Reporter: Damien Dubé
             Fix For: 1.0.0-M13


If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 

I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.



    public Object makeObject() throws Exception
    {
        LOG.debug("creating a LDAP connection");

        LdapNetworkConnection connection = new LdapNetworkConnection(config);
        try {
            connection.bind(config.getName(), config.getCredentials());
        } catch (Exception e1) {
            try {
                connection.close();
            } catch (Exception e2) {

            }
            throw e1;
        }
        return connection;
    }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DIRAPI-96) Connection leak in LdapConnectionPool.

Posted by "Damien Dubé (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRAPI-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13498470#comment-13498470 ] 

Damien Dubé commented on DIRAPI-96:
-----------------------------------

Not trying to be picky; but I looked at the patch and I would try/catch the
close so that the exception thrown will always be the bind exception and
not a possible close exception.

Damien Dubé
damien.dube@gmail.com


On Thu, Nov 15, 2012 at 6:55 PM, Emmanuel Lecharny (JIRA)


                
> Connection leak in LdapConnectionPool.
> --------------------------------------
>
>                 Key: DIRAPI-96
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
>             Project: Directory Client API
>          Issue Type: Bug
>            Reporter: Damien Dubé
>             Fix For: 1.0.0-M13
>
>
> If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 
> I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.
>     public Object makeObject() throws Exception
>     {
>         LOG.debug("creating a LDAP connection");
>         LdapNetworkConnection connection = new LdapNetworkConnection(config);
>         try {
>             connection.bind(config.getName(), config.getCredentials());
>         } catch (Exception e1) {
>             try {
>                 connection.close();
>             } catch (Exception e2) {
>             }
>             throw e1;
>         }
>         return connection;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DIRAPI-96) Connection leak in LdapConnectionPool.

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRAPI-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13506350#comment-13506350 ] 

Hendy Irawan commented on DIRAPI-96:
------------------------------------

Since it wasn't fixed in M13, this bug should be marked as:

Affects Version: M13
Fix Version: M14
                
> Connection leak in LdapConnectionPool.
> --------------------------------------
>
>                 Key: DIRAPI-96
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
>             Project: Directory Client API
>          Issue Type: Bug
>            Reporter: Damien Dubé
>             Fix For: 1.0.0-M13
>
>
> If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 
> I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.
>     public Object makeObject() throws Exception
>     {
>         LOG.debug("creating a LDAP connection");
>         LdapNetworkConnection connection = new LdapNetworkConnection(config);
>         try {
>             connection.bind(config.getName(), config.getCredentials());
>         } catch (Exception e1) {
>             try {
>                 connection.close();
>             } catch (Exception e2) {
>             }
>             throw e1;
>         }
>         return connection;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DIRAPI-96) Connection leak in LdapConnectionPool.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRAPI-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13498479#comment-13498479 ] 

Emmanuel Lecharny commented on DIRAPI-96:
-----------------------------------------

I was considering your suggestion, but at this point, if the close() throws an exception, it's way more critical than the bind exception, and I would not like to miss it as a user...

wdyt ?

I'm adding a LOG btw.
                
> Connection leak in LdapConnectionPool.
> --------------------------------------
>
>                 Key: DIRAPI-96
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
>             Project: Directory Client API
>          Issue Type: Bug
>            Reporter: Damien Dubé
>             Fix For: 1.0.0-M13
>
>
> If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 
> I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.
>     public Object makeObject() throws Exception
>     {
>         LOG.debug("creating a LDAP connection");
>         LdapNetworkConnection connection = new LdapNetworkConnection(config);
>         try {
>             connection.bind(config.getName(), config.getCredentials());
>         } catch (Exception e1) {
>             try {
>                 connection.close();
>             } catch (Exception e2) {
>             }
>             throw e1;
>         }
>         return connection;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (DIRAPI-96) Connection leak in LdapConnectionPool.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRAPI-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRAPI-96.
-------------------------------------

    Resolution: Fixed

Fixed with : http://svn.apache.org/viewvc?rev=1410114&view=rev

Many thanks for the report and the patch !
                
> Connection leak in LdapConnectionPool.
> --------------------------------------
>
>                 Key: DIRAPI-96
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
>             Project: Directory Client API
>          Issue Type: Bug
>            Reporter: Damien Dubé
>             Fix For: 1.0.0-M13
>
>
> If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 
> I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.
>     public Object makeObject() throws Exception
>     {
>         LOG.debug("creating a LDAP connection");
>         LdapNetworkConnection connection = new LdapNetworkConnection(config);
>         try {
>             connection.bind(config.getName(), config.getCredentials());
>         } catch (Exception e1) {
>             try {
>                 connection.close();
>             } catch (Exception e2) {
>             }
>             throw e1;
>         }
>         return connection;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DIRAPI-96) Connection leak in LdapConnectionPool.

Posted by "Damien Dubé (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRAPI-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13498938#comment-13498938 ] 

Damien Dubé commented on DIRAPI-96:
-----------------------------------

I would think that the Exception that I would like to have is the bind exception. But it is true that if the close fails, I probably want this one. 
Hopefully this won't happen much!
                
> Connection leak in LdapConnectionPool.
> --------------------------------------
>
>                 Key: DIRAPI-96
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-96
>             Project: Directory Client API
>          Issue Type: Bug
>            Reporter: Damien Dubé
>             Fix For: 1.0.0-M13
>
>
> If a Connection fails on credentials, the LdapConnection is not closed and is not in the pool. 
> I modified the makeObject() function in PoolableLdapConnectionFactory.java to this and it does the trick.
>     public Object makeObject() throws Exception
>     {
>         LOG.debug("creating a LDAP connection");
>         LdapNetworkConnection connection = new LdapNetworkConnection(config);
>         try {
>             connection.bind(config.getName(), config.getCredentials());
>         } catch (Exception e1) {
>             try {
>                 connection.close();
>             } catch (Exception e2) {
>             }
>             throw e1;
>         }
>         return connection;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira