directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Natan Abolafya (Jira)" <j...@apache.org>
Subject [jira] [Commented] (DIRAPI-358) File Descriptor leak on connection failure with LdapConnectionTemplate
Date Thu, 07 May 2020 15:35:00 GMT

    [ https://issues.apache.org/jira/browse/DIRAPI-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17101785#comment-17101785
] 

Natan Abolafya commented on DIRAPI-358:
---------------------------------------

Oh, sorry, I thought it would be clear enough and more concise this way. I'm newbie to Jira
so not sure if it's because I can't find how to edit the description or it's not allowed.
So I guess I'll paste how we generate the template here:
{quote}{color:#000000}LdapConnectionConfig config {color}= {color:#0033b3}new {color}LdapConnectionConfig();
{color:#000000}config{color}.setTimeout({color:#000000}10000{color});
{color:#000000}config{color}.setLdapHost({color:#000000}hostname{color});
{color:#000000}config{color}.setLdapPort(port);
{color:#000000}config{color}.setUseSsl(sslEnabled);{color:#8c8c8c}
{color}{color:#000000}config{color}.setName(adminUsername);
{color:#000000}config{color}.setCredentials(adminPassword);

// Use java's trust manager
{color:#000000}TrustManagerFactory tmf {color}= {color:#000000}TrustManagerFactory{color}.getInstance({color:#000000}TrustManagerFactory{color}.getDefaultAlgorithm());
{color:#000000}tmf{color}.init(({color:#000000}KeyStore{color}) {color:#0033b3}null{color});
{color:#000000}config{color}.setTrustManagers({color:#000000}tmf{color}.getTrustManagers());

{color:#000000}DefaultLdapConnectionFactory connectionFactory {color}= {color:#0033b3}new
{color}DefaultLdapConnectionFactory({color:#000000}config{color});
{color:#000000}connectionFactory{color}.setTimeOut({color:#000000}10000{color});
{color:#000000}GenericObjectPoolConfig poolConfig {color}= {color:#0033b3}new {color}GenericObjectPoolConfig();
{color:#000000}poolConfig{color}.setMaxTotal({color:#1750eb}64{color});
{color:#000000}poolConfig{color}.setTestOnBorrow({color:#0033b3}true{color});
{color:#000000}poolConfig{color}.setTimeBetweenEvictionRunsMillis({color:#1750eb}30 {color}*
{color:#1750eb}60000{color}); {color:#8c8c8c}// Every thirty minutes, idle connections will
be cleaned up.
{color}{color:#000000}poolConfig{color}.setMinEvictableIdleTimeMillis({color:#1750eb}2 {color}*
{color:#1750eb}60000{color}); {color:#8c8c8c}// the connections that are idle for at least
2 minutes will be "evicted"
{color}{color:#000000}poolConfig{color}.setNumTestsPerEvictionRun({color:#1750eb}64{color});
{color:#8c8c8c}// default is 3; go through them all.
{color}{color:#0033b3}var template = new {color}LdapConnectionTemplate({color:#0033b3}new
{color}LdapConnectionPool({color:#0033b3}new {color}ValidatingPoolableLdapConnectionFactory({color:#000000}connectionFactory{color}),
{color:#000000}poolConfig{color}));

template.searchFirst(....);
{quote}
 

Normally we store the template and reuse it and so on as it's designed to be and it used to
work fine on 2.0.0.AM2. The problem appeared when we upgraded to AM4. Then I started testing
different versions and it seems to be fine on AM3 also.

 

I did some simple testing to verify the problem. Ran this command to see how many file descriptors
our application has:

{color:#e01e5a}lsof -n -p <pid> | wc -l{color}

Then made the application connect to a random IP and fail a few times. Then ran the command
again to see how much increase has occurred. On AM3 and older, the fd count went back to the
original after some 10-20 seconds while on AM4 and older, it never went back even when I left
it overnight.

 

> File Descriptor leak on connection failure with LdapConnectionTemplate
> ----------------------------------------------------------------------
>
>                 Key: DIRAPI-358
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-358
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 2.0.0.AM4, 2.0.0, 2.0.1
>            Reporter: Natan Abolafya
>            Priority: Major
>
> Seems to have appeared on AM4.
>  
> We had two instances crashing after half an hour outage on the LDAP server because the
process ran out of file descriptor limit.
>  
>  
> {noformat}
> var template = createLdapConnectionTemplate();
> template.searchFirst(....);
> {noformat}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org


Mime
View raw message