Under memcache-client-1.5.0 and ruby-net-ldap 0.4:
#!/usr/bin/ruby
require 'rubygems'
require 'net/ldap'
require 'memcache'
CACHE = MemCache.new 'localhost:11211'
puts CACHE.get('foo')
ldap = Net::LDAP.new(:host => "ldap.columbia.edu", :port => 389)
f = Net::LDAP::Filter.eq("sn", "Altshuler")
res = ldap.search(:filter => f)
puts res
This will always die with the following error:
/Library/Ruby/Gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1104:in `bind': no bind result (Net::LDAP::LdapError)
from /Library/Ruby/Gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:639:in `search'
from /Users/hagus/Desktop/memcache-test.rb:14
It appears that after Server#socket has done its thing in memcache.rb, future attempts to open a socket get hosed in
some subtle fashion. Unfortunately it's 1 am and I've no time to debug further.
To resolve this, I basically just ripped out the use of "timeout" from Server#socket. I'm not sure what the
ramifications of this are, but at least I'm up and running. |