Weird Crash on LDAP Search

Discussion in 'Ruby' started by Thorsten Haude, Jul 28, 2005.

  1. --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--
    Thorsten Haude, Jul 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mark
    Replies:
    0
    Views:
    336
  2. Replies:
    1
    Views:
    526
    Raymond DeCampo
    Feb 21, 2006
  3. Tony_C

    Calling free() causes weird crash.

    Tony_C, Jun 12, 2010, in forum: C Programming
    Replies:
    2
    Views:
    405
  4. Chris Sheppard
    Replies:
    1
    Views:
    94
    Stephan Kämper
    Sep 17, 2004
  5. Replies:
    14
    Views:
    245
    Richard Cornford
    Nov 7, 2005
Loading...

Share This Page