Re: too many open files

Klemens Kittan <[email protected]> Tue, 04 May 2010 14:34:58 +0200
Newsgroups gmane.network.openldap.general
Message-ID <[email protected]>
--=-4ge6g4FLv5PeXhZ+Kk6q
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hello,

> > Hello,
> >=20
> > don't want to discourage you, but my slapd (2.4.11 on Debian Lenny)
> > still has problems with more than 1024 files.
> >=20
> > 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
> >=20
> > In a loop from a python script, I then connect, bind, search the ldap
> > server and keep all the connections open, like so:
> >=20
> > ...
> > def ldap_connection_func():
> >   global n
> >   l =3D ldap.initialize("ldaps://ldap...")
> >   l.simple_bind_s(username, password)
> >   l.search_s('dc=3Dhaiti,...', ldap.SCOPE_SUBTREE, 'objectclass=3D*')
> >   n.append(l)
> >=20
> > for x in range(0,1100):
> >   ldap_connection_func()
> > ...
>=20
>=20
> What was the ulimit -n in the shell from which you ran this python script=
? If=20
> you are using a single process to generate the load to the server, this=20
> process obviously also needs to be able to open sufficient files.

Ah, I see.
I just have adjusted the ulimit size on the server side (to 4096). I
never thought about the client's side, where I started the script. Here,
the "ulimit -n" is 1024. Indeed, if the client tries to open less than
1024 files, everything is fine. Even if I start the script 3 times (each
in a separate shell) everything runs as expected. The clients and the
server do not have a problem, in detail, the server opened more than
1024 files at the same time successfully.

> > 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 keep=
s
> > running.
>=20
> It is funny that slapd opened more than 1024 files then, as it should eit=
her=20
> have stopped at less than 1024 fd's (as it has other files open), or the =
script=20
> should have reached 1100 connections, or your script is running with a fi=
le=20
> descriptor limit.
>=20
> > We now will try to set the idletimeout parameter to some sensible value
>=20
> It looks like your slapd file descriptor limit is now taking effect, you =
just=20
> need to test better, and/or interpret the results better ....

Yes, you are right.
I should set ulimit in the /etc/default/slapd and it will work.

> Regards,
> Buchan

Regards,
Klemens

--=20
Klemens Kittan
Systemadministrator

Uni-Potsdam, Inst. f. Informatik
August-Bebel-Str. 89
14482 Potsdam

Tel.    : +49-331-9773125
Fax.    : +49-331-9773122
eMail   : [email protected]

gpg --recv-keys --keyserver wwwkeys.de.pgp.net 6EA09333


--=-4ge6g4FLv5PeXhZ+Kk6q
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkvgFGwACgkQZ1HXi26gkzN+WQCeI4ZMCN0XedbgpkuFWaWaiKiM
kHIAoJMFBMFsb+1t3wqvWyBO8xEKcKLS
=0/Bo
-----END PGP SIGNATURE-----

--=-4ge6g4FLv5PeXhZ+Kk6q--