[DRE-maint] Bug#330919: libldap-ruby1.8: Use of LDAP::Entry#[](attr) leads to excessive memory use

Antonio Terceiro terceiro at debian.org
Tue Jan 3 21:59:31 UTC 2012


tag 330919 + unreproducible
thanks

Hi Paul,

Paul van Tilburg escreveu isso aí:
> Package: libldap-ruby1.8
> Version: 0.9.0-1
> Severity: important
> 
> Executing the following simple program leads to execssive memory use (>
> 500MB within seconds):
> 
>   ldap.simple_bind(Admin, Pass) do |conn|
>     conn.search("ou=DNS,#{Root}", LDAP_SCOPE_SUBTREE,
>                 "(|(ildusOwner=bram)(ildusOwner=paul))") do |entry|
>       puts "dn: #{entry.dn}"
>       entry.attrs.each do |attr|
>         entry[attr].each do |val|
>           puts "#{attr}: #{val}"
>         end
>       end
>       puts
>     end
>   end
> 
> However, when "entry[attr].each" is replaced by its (according to the
> documentation[1]) aliased version "entry.vals(attr).each" it works
> fine.  Also "entry.to_ldif" seems to suffer from the same problem.
> 
> Paul
> 
> 1: http://ruby-ldap.sourceforge.net/rdoc/classes/LDAP/Entry.html#M000010

Can you reproduce this problem with the latest version from sid
(ruby-ldap 0.9.11-1)?

I tried to reproduce it locally, but it seems like your script is not
complete. I tried the following code, against a local development LDAP
database of mine:

############################################################################
require 'ldap'
ldap = LDAP::Conn.new('localhost', 389)
ldap.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
Admin = 'cn=admin,dc=nodomain'
Pass = 'test'
Root = 'dc=development,dc=nodomain'
ldap.simple_bind(Admin, Pass) do |conn|
  conn.search("ou=Groups,#{Root}", LDAP::LDAP_SCOPE_SUBTREE, "objectclass=posixGroup") do |entry|
    puts "dn: #{entry.dn}"
    entry.attrs.each do |attr|
      entry[attr].each do |val|
        puts "#{attr}: #{val}"
      end
    end
    puts
  end
end

# wait in the end so that I can check htop(1) for the memory usage of the
# process
$stdin.gets
############################################################################

-- 
Antonio Terceiro <terceiro at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20120103/e9c0a09c/attachment.pgp>


More information about the Pkg-ruby-extras-maintainers mailing list