You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Ado Dao <ad...@hotmail.de> on 2011/02/24 15:24:34 UTC

How to close the LDAP client connection from ApacheDS

Hi,

we have found following exception in the log file. A ware any known problems.


NioSocketAcceptor-1 WARN util.DefaultExceptionMonitor| Unexpected exception.
java.io.IOException: Too many open files
        at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
        at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:217)
        at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48)
        at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.processHandles(AbstractPollingIoAcceptor.java:481)
        at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:412)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)


It looks like some ldap clients keep the connection to the apachds alive. 
Is there any option to close the ldap connection after given timeout serverside.

Thanks 
Ado
 		 	   		  

Re: How to close the LDAP client connection from ApacheDS

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/24/11 5:32 PM, Ado Dao wrote:
>> Also not that if you are on linux, the default number of handles you can
>> open is 1000, which is far too low for a LDAP server, assuming you might
>> have ten of thousands opened connections. Tune your system.
>
> I also agree you. But I
>   suspect that the number of
> open connections is steadily increasing, because
>   the error occurred after several days. After a
>   restart the ldap server it was OK.
>
> It looks like some
>   clients do not terminate
>   the connection. Therefore, the
>   question whether there is
>   an option for the
>   server, which terminates such
>   open connections after a timeout.
If the client disconnect without notice, yes, the connection will remain 
until we detect it.

One option would be to tune the TCP stack to close idle connections. 
Usually, it's set to 30 minutes.

Regarding the support of idle connection in the server, I don't think we 
handle that atm, but it would be a good addition. Feel free to create a 
JIRA, it should not be a complicated modification in the server to 
handle idle connections with a configurable timeout.

Also note that due to the connected nature of LDAP, one client might be 
connected for a very long time without sending a new request, so be very 
conservative with such a configuration. Establishing a connection  is 
costly and requires you store the credentials on the client, when 
manaing tens of thousands connection which do nothing is just a no 
brainer...

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


RE: How to close the LDAP client connection from ApacheDS

Posted by Ado Dao <ad...@hotmail.de>.
Hi,

thanks for the quick reply. 


> Date: Thu, 24 Feb 2011 16:04:09 +0100
> From: elecharny@gmail.com
> To: users@directory.apache.org
> Subject: Re: How to close the LDAP client connection from ApacheDS
> 
> On 2/24/11 3:24 PM, Ado Dao wrote:
> > Hi,
> >
> > we have found following exception in the log file. A ware any known problems.
> >
> >
> > NioSocketAcceptor-1 WARN util.DefaultExceptionMonitor| Unexpected exception.
> > java.io.IOException: Too many open files
> >          at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
> >          at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
> >          at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:217)
> >          at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48)
> >          at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.processHandles(AbstractPollingIoAcceptor.java:481)
> >          at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:412)
> >          at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> >          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >          at java.lang.Thread.run(Thread.java:662)
> >
> >
> > It looks like some ldap clients keep the connection to the apachds alive.
> 
> Where are those log files coming from ? Which version of the application ?


We use 
the ApacheDS
  1.5.7 in an embedded version with
 a custom partition. 
The log 
files are from the log
 framework of ApacheDS.





> 
> Also not that if you are on linux, the default number of handles you can 
> open is 1000, which is far too low for a LDAP server, assuming you might 
> have ten of thousands opened connections. Tune your system.


I also agree you. But I
 suspect that the number of 
open connections is steadily increasing, because
 the error occurred after several days. After a
 restart the ldap server it was OK.

It looks like some
 clients do not terminate
 the connection. Therefore, the
 question whether there is
 an option for the
 server, which terminates such
 open connections after a timeout.



--
Ado

 
 		 	   		  

Re: How to close the LDAP client connection from ApacheDS

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/24/11 3:24 PM, Ado Dao wrote:
> Hi,
>
> we have found following exception in the log file. A ware any known problems.
>
>
> NioSocketAcceptor-1 WARN util.DefaultExceptionMonitor| Unexpected exception.
> java.io.IOException: Too many open files
>          at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
>          at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
>          at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:217)
>          at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48)
>          at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.processHandles(AbstractPollingIoAcceptor.java:481)
>          at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:412)
>          at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>          at java.lang.Thread.run(Thread.java:662)
>
>
> It looks like some ldap clients keep the connection to the apachds alive.

Where are those log files coming from ? Which version of the application ?

Also not that if you are on linux, the default number of handles you can 
open is 1000, which is far too low for a LDAP server, assuming you might 
have ten of thousands opened connections. Tune your system.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com