[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: too many open files

On Friday, 30 April 2010 11:16:09 Klemens Kittan wrote:
> Hello,
> don't want to discourage you, but my slapd (2.4.11 on Debian Lenny)
> still has problems with more than 1024 files.
> I have
> -- ulimit -n 4096 in /etc/default/slapd
> -- checked the output of /proc/`pidof slapd`/limits
> -- downloaded the source package from Debian (version 2.4.11),
>    did a grep for FD_SETSIZE and found that it is set to 4096
> -- built a new package from these sources with configure options:
>    --disable-tcpwrapper
> In a loop from a python script, I then connect, bind, search the ldap
> server and keep all the connections open, like so:
> ...
> def ldap_connection_func():
>   global n
>   l = ldap.initialize("ldaps://ldap...")
>   l.simple_bind_s(username, password)
>   l.search_s('dc=haiti,...', ldap.SCOPE_SUBTREE, 'objectclass=*')
>   n.append(l)
> for x in range(0,1100):
>   ldap_connection_func()
> ...

What was the ulimit -n in the shell from which you ran this python script? If 
you are using a single process to generate the load to the server, this 
process obviously also needs to be able to open sufficient files.

> I see the number of open files of the slapd process rise to about 1080,
> then all connections opened from the script are closed while slapd keeps
> running.

It is funny that slapd opened more than 1024 files then, as it should either 
have stopped at less than 1024 fd's (as it has other files open), or the script 
should have reached 1100 connections, or your script is running with a file 
descriptor limit.

> We now will try to set the idletimeout parameter to some sensible value

It looks like your slapd file descriptor limit is now taking effect, you just 
need to test better, and/or interpret the results better ....