google-code-export / ruby-activeldap

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

NoMethodError: undefined method `ord' for nil:NilClass #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start new session with script/console
2. Check the presence of the first user
3. Waiting about 15 minutes (tcpdump help to find the moment)
4. Retry to check the presence of the first user

What is the expected output? What do you see instead?

Expected : 
ree-1.8.7-2010.02 > Ldap::User.first
 => #<Ldap::User objectClass:....

Instead :
ree-1.8.7-2010.02 > Ldap::User.first
NoMethodError: undefined method `ord' for nil:NilClass
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:in `method_missing'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/net-ldap-0.1.1/lib/net/ldap.rb:1139:in `getbyte'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/net-ldap-0.1.1/lib/net/ber/ber_parser.rb:41:in `read_ber'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/net-ldap-0.1.1/lib/net/ldap.rb:1422:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/net-ldap-0.1.1/lib/net/ldap.rb:1385:in `loop'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/net-ldap-0.1.1/lib/net/ldap.rb:1385:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:143:in `send'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:143:in `execute'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659:in `log'
    from /Users/toto/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/benchmark.rb:308:in `realtime'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659:in `log'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:141:in `execute'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:78:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:170:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:275:in `operation'
    from /Users/toto/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/timeout.rb:53:in `timeout'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/timeout_stub.rb:6:in `alarm'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:321:in `with_timeout'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:274:in `operation'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:169:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:66:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:65:in `search'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:284:in `find_every'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:257:in `find_initial'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:222:in `find'
    from /Users/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:238:in `first'

What version of the product are you using? On what operating system?

Mac OS X 10.6.4 / Ubuntu 10.04
Rvm 1.0.0 
Ruby 1.8.7 Ruby Enterprise Edition 2010.02
Rails 2.3.8
ActiveLdap 1.2.2
NetLdap 0.1.1

Please provide any additional information below.

I traced this issue with tcpdump with src which is my ActiveDirectory IP just 
after my first working Ldap::User.first
When I obtain an output log into tcpdump, I'm trying once more and I have this 
error into my rails log

Regards 

Original issue reported on code.google.com by cedric.f...@gmail.com on 15 Oct 2010 at 8:37

Attachments:

GoogleCodeExporter commented 9 years ago
Do you need some more details about this issue?

Original comment by cedric.f...@gmail.com on 28 Oct 2010 at 8:35

GoogleCodeExporter commented 9 years ago
Sorry for my late response...

It seems that Net::LDAP doesn't handle a connection disconnected by LDAP server 
well. We will be able to add workaround for it into ActiveLdap but it should be 
fixed in Net::LDAP. Could you also report it to Net::LDAP developers?

Those instructions will reproduce your problem:

  ldap = Net::LDAP.new(..., :encryption => {:method => :simple_tls})
  ldap.bind(...)
  ldap.search(...) # will succeed
  # wait 15 minutes
  ldap.search(...) # will fail

Original comment by kou...@gmail.com on 28 Oct 2010 at 8:57

GoogleCodeExporter commented 9 years ago
Issue posted on ruby-forge project page.

Thx

I'll post the result if necessary

Original comment by cedric.f...@gmail.com on 28 Oct 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Switch from net-ldap to ruby-ldap solved this issue.
I still have no answer on ruby-forge project page.

I was not alone http://rubyforge.org/forum/message.php?msg_id=93677

Tcpdump show activity trace during inactivity session

Regards,

CF 

Original comment by cedric.f...@gmail.com on 9 Nov 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Hum, 

unfortunately, it works on MacOS X but doesn''t on Ubuntu 10.04 with ruby-ldap 
(0.9.11, 0.9.10, 0.9.9)

$ script/console 
Loading development environment (Rails 2.3.8)
ree-1.8.7-2010.02 > Ldap::User.first
ActiveLdap::ConnectionError: Giving up trying to reconnect to LDAP server.
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:597:in `reconnect'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:574:in `loop'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:574:in `reconnect'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:611:in `reconnect_if_need'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in `call'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in `alarm'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:321:in `with_timeout'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:610:in `reconnect_if_need'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:272:in `operation'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:169:in `search'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:83:in `search'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:65:in `search'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:284:in `find_every'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:257:in `find_initial'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:222:in `find'
    from /home/toto/.rvm/gems/ree-1.8.7-2010.02/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:238:in `first'
    from (irb):1ree-1.8.7-2010.02 > 

Original comment by cedric.f...@gmail.com on 10 Nov 2010 at 10:58

GoogleCodeExporter commented 9 years ago
Modifying /etc/ldap/ldap.conf to have this line :
TLS_REQCERT never

fixed the issue

Original comment by cedric.f...@gmail.com on 10 Nov 2010 at 4:43

GoogleCodeExporter commented 9 years ago
Thanks for the information.
Can I close this issue?

> Modifying /etc/ldap/ldap.conf to have this line :
> TLS_REQCERT never
>
> fixed the issue

Does it mean that ldapsearch also fails to connect ActiveDirectory server 
without the configuration?

Original comment by kou...@gmail.com on 10 Nov 2010 at 9:49

GoogleCodeExporter commented 9 years ago
Yep we can close this issue.

I didn't check it out with ldapsearch but I think so
I'll check it out next time 

Original comment by cedric.f...@gmail.com on 16 Nov 2010 at 3:53

GoogleCodeExporter commented 9 years ago

Original comment by kou...@gmail.com on 16 Nov 2010 at 10:33