google-code-export / ruby-activeldap

Automatically exported from code.google.com/p/ruby-activeldap
Other
1 stars 1 forks source link

Critical Issue: NoMemoryError when calling ldap.rb:94:in `vals'! #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
OS: Centos5.3
libldap-ruby1.8
activeldap1.0.9
ruby1.8.7

I have spend many hours on this critical issue. My openldap has about 10K
ldap entries. When calling find("cn=yunnan,c=cn") in rails production
environment, there will be NoMemoryError! 

NoMemoryError (failed to allocate memory):
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `vals'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `each'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `send'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:90:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:165:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:266:in `operation'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `call'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `alarm'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:312:in `with_timeout'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:265:in `operation'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:164:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:83:in `search'
  activeldap (1.0.9) lib/active_ldap/operations.rb:65:in `search'
  activeldap (1.0.9) lib/active_ldap/operations.rb:269:in `find_every'
  activeldap (1.0.9) lib/active_ldap/operations.rb:242:in `find_initial'
  activeldap (1.0.9) lib/active_ldap/operations.rb:309:in `find_one'
  activeldap (1.0.9) lib/active_ldap/operations.rb:296:in `find_from_dns'
  activeldap (1.0.9) lib/active_ldap/operations.rb:215:in `find'
  app/controllers/monet_controller.rb:325:in `find_path_and_subnodes'
  app/controllers/application_controller.rb:162:in `set_language'
  app/controllers/application_controller.rb:162:in `set_language'

Original issue reported on code.google.com by ery....@gmail.com on 15 Jul 2009 at 4:06

GoogleCodeExporter commented 9 years ago
It make me crazy!

Original comment by ery....@gmail.com on 15 Jul 2009 at 4:06

GoogleCodeExporter commented 9 years ago
  LDAP: connect (2.3ms): {:with_start_tls=>false, :uri=>"ldap://localhost"}
  LDAP: bind (0.7ms): {:dn=>"cn=admin,c=cn"}
Bound to ldap://localhost by simple as cn=admin,c=cn
  LDAP: search (0.6ms): {:attributes=>["subschemaSubentry"],
:filter=>"objectClass=*", :scope=>:base, :base=>""}
  LDAP: search: FAILED (0.0ms): {:error_message=>"failed to allocate memory",
:attributes=>["objectClasses", "attributeTypes", "matchingRules", 
"matchingRuleUse",
"dITStructureRules", "dITContentRules", "nameForms", "ldapSyntaxes"],
:error=>"NoMemoryError", :filter=>"(objectClass=subschema)", :scope=>:base,
:base=>"cn=Subschema"}

NoMemoryError (failed to allocate memory):
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `vals'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `each'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `send'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:90:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:165:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:266:in `operation'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `call'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `alarm'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:312:in `with_timeout'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:265:in `operation'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:164:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:83:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:137:in `schema'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:266:in `operation'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `call'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `alarm'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:312:in `with_timeout'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:265:in `operation'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:117:in `schema'
  activeldap (1.0.9) lib/active_ldap/connection.rb:284:in `schema'
  activeldap (1.0.9) lib/active_ldap/base.rb:995:in `schema'
  activeldap (1.0.9) lib/active_ldap/object_class.rb:62:in
`assert_valid_object_class_value'
  activeldap (1.0.9) lib/active_ldap/object_class.rb:44:in `assert_object_classes'
  activeldap (1.0.9) lib/active_ldap/object_class.rb:29:in `classes='
  activeldap (1.0.9) lib/active_ldap/base.rb:1103:in `initialize_by_ldap_data'
  activeldap (1.0.9) lib/active_ldap/base.rb:597:in `instantiate_without_callbacks'
  activeldap (1.0.9) lib/active_ldap/base.rb:596:in `instance_eval'
  activeldap (1.0.9) lib/active_ldap/base.rb:596:in `instantiate_without_callbacks'
  activeldap (1.0.9) lib/active_ldap/callbacks.rb:29:in `instantiate'
  activeldap (1.0.9) lib/active_ldap/operations.rb:270:in `find_every'
  activeldap (1.0.9) lib/active_ldap/operations.rb:269:in `collect'
  activeldap (1.0.9) lib/active_ldap/operations.rb:269:in `find_every'
  activeldap (1.0.9) lib/active_ldap/operations.rb:242:in `find_initial'
  activeldap (1.0.9) lib/active_ldap/operations.rb:309:in `find_one'
  activeldap (1.0.9) lib/active_ldap/operations.rb:296:in `find_from_dns'
  activeldap (1.0.9) lib/active_ldap/operations.rb:215:in `find'
  app/controllers/monet_controller.rb:325:in `find_path_and_subnodes'
  app/controllers/application_controller.rb:162:in `set_language'
  app/controllers/application_controller.rb:162:in `set_language'

Original comment by ery....@gmail.com on 15 Jul 2009 at 4:08

GoogleCodeExporter commented 9 years ago
Could you tell us a result of the command?

  % ldapsearch -x -H ldap://localhost -W -D cn=admin,c=cn -s base -b 'cn=Subschema'
'(objectClass=*)' objectClasses attributeTypes matchingRules matchingRuleUse
dITStructureRules dITContentRules nameForms ldapSyntaxes | wc

Are you using Ruby/LDAP 0.9.9? (0.9.9 is the latest version.)

Original comment by kou...@gmail.com on 16 Jul 2009 at 12:00

GoogleCodeExporter commented 9 years ago
Thanks for your reply, Koutou. I tried both Ruby/Ldap0.9.7/0.9.8.

Original comment by ery....@gmail.com on 16 Jul 2009 at 2:08

GoogleCodeExporter commented 9 years ago
[root@localhost bin]# ldapsearch -x -H ldap://localhost -W -D cn=admin,c=cn -s 
base
-b 'cn=Subschema' '(objectClass=*)' objectClasses attributeTypes matchingRules
matchingRuleUse dITStructureRules dITContentRules nameForms ldapSyntaxes | 
wcEnter
LDAP Password: 
   1484   10358   95008
[root@localhost bin]# 

Original comment by ery....@gmail.com on 16 Jul 2009 at 2:23

GoogleCodeExporter commented 9 years ago
Uhm.
Your schema is normal. Not too large.

Do you have enough memory?

Could you try Net::LDAP trunk?

Original comment by kou...@gmail.com on 16 Jul 2009 at 3:08

GoogleCodeExporter commented 9 years ago
Net::LDAP trunk from sourceforge? Could u tell me what's happened? Which part 
consume
too much memory?

Original comment by ery....@gmail.com on 16 Jul 2009 at 3:40

GoogleCodeExporter commented 9 years ago
How to use Net::LDAP trunk:
  % cd RAILS_ROOT
  % svn co http://net-ldap.rubyforge.org/svn/trunk vendor/net-ldap-trunk
  % vim config/ldap.yml # add "adapter: net-ldap" to "production" section.
                        # e.g.:
                        #   production:
                        #     host: ...
                        #     ...
                        #     adapter: net-ldap

I don't know what's happened too.
We need to find which causes the problem. Using another LDAP client backend is 
a way
to find the problem point.

Original comment by kou...@gmail.com on 16 Jul 2009 at 4:06

GoogleCodeExporter commented 9 years ago
Thanks, I try it at once. 

Original comment by ery....@gmail.com on 16 Jul 2009 at 4:08

GoogleCodeExporter commented 9 years ago
It seems ok now:) I guess this is caused by libruby-ldap library. Thank u very 
much.
U did the great work. Could I donate some dollars to this project? Thanks for 
your
support again.

Original comment by ery....@gmail.com on 16 Jul 2009 at 4:27

GoogleCodeExporter commented 9 years ago
Thanks for your offer but we can't accept your donation because we doesn't have
donation mechanism.
We will accept just your feelings. :-)

Original comment by kou...@gmail.com on 16 Jul 2009 at 4:38