From: Thorsten Haude Date: 2005-07-29T05:41:40+09:00 Subject: Weird Crash on LDAP Search --bAmEntskrkuBymla Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I tried to read some values from an LDAP server last week when I made a tiny error of pretty great consequences. So please don't excecute the following code of you value your uptime: - - - Schnipp - - - @theServer =3D 'some.server' @theBaseDN =3D 'ou=3Dexample, dc=3Dexample, dc=3Dcom' begin # exception block for LDAP::Conn.open() @connection =3D LDAP::Conn.open(@theServer) @logger.debug("Connected to LDAP server #{@theServer}") @connection.search(@theBaseDN, 1, '(objectclass=3D*)') { |entry| print "#{entry.get_dn}\n" entry.attr.each { |attribute| print "\t#{attribute}\n" } } rescue LDAP::Error =3D> error @logger.error("#{@myName}: #{error.class} while connected to #{@theServ= er}: #{error}") end - - - Schnapp - - - It took me some time to find the error, esp. since my box became unusable a few seconds after starting the program, apparantly because the program alloced huge amounts of memory. Now what I don't get is the reason why it runs at all. If you are quick, you can interrupt the program to get an error message saying something similar to "LDAP::Entry does not have a method named attr". Indeed, the method is called 'attrs'. So why is this run at all? Why the huge memory demand? What we could think of is that the each block tries to write out each complete object accessible to attr, but even that does not explain the memory consumption. (Sorry if some parts are a bit vague, but I'm reluctant to start this again to get details.) Thorsten --=20 Das Briefgeheimnis sowie das Post- und Fernmeldegeheimnis sind unverletzlic= h. - Grundgesetz, Artikel 10, Abs. 1=20 --bAmEntskrkuBymla Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFC6UJCW/x2JEBlodoRAoRZAKDQLD9UhBm2dwOwG2wQhbZXoPOnpACfWxB4 Aq2dvk6shKR4AF04I0Txkvc= =S8XA -----END PGP SIGNATURE----- --bAmEntskrkuBymla--