Ruby-ldap crashing WEBrick server


#1

We are trying to use Ruby-ldap 0.9.4 with Ruby 1.84 on Rails 1.1.2. All
is running on top of Solaris 2.8.

The overall setup works fine for doing other things like access an
Oracle DB, and displaying items. When it comes to using Ruby-ldap
though, it is quite a different matter. We’ve tried using Ruby-ldap
within irb, and all seems well. The basic scenario is:

conn = LDAP::Conn.new(‘server_name’, 389)
conn.bind(account_here, password_here)
my_results = conn.search2(‘base_here’, LDAP::LDAP_SCOPE_SUBTREE,
filter_here, attrs=nil)

When the third line is executed we get (again, all works fine in irb):

WEBrick server error:

Assertion failed: LDAP_VALID( ld ), file error.c, line 257
[2006-04-20 14:38:15] INFO WEBrick 1.3.1
[2006-04-20 14:38:15] INFO ruby 1.8.4 (2005-12-24) [sparc-solaris2.8]
[2006-04-20 14:38:15] INFO WEBrick::HTTPServer#start: pid=1290
port=3000
Abort (core dumped)

lines 247-257 of error.c (line 257 is blank):

void
rb_check_type(x, t)
VALUE x;
int t;
{
struct types *type = builtin_types;

if (x == Qundef) {
rb_bug("undef leaked to the Ruby space");
}

Any ideas?

Thanks,
Jeff


#2

Jeff,

I have about the same setup except that I’m running Suse instead of
Solaris. I also found that, after installing openldap and ruby/ldap, I
could run unittests and get an ldap connection in the irb, but I had
totally consistent ldap failures (albeit with slightly different
symptoms) trying to run ldap under webrick.

I finally figured out that if I let ‘boot.rb’ run before I required
‘ldap’, I got failures. I ended up putting a require ‘ldap’ in
script/server and in my environment.rb before the Rails configuration
stuff.

I read something recently about an oci8 method conflicting with
something in ldap… which may be related. If you search the newsgroup
you should find that post.

Anyway, it’s worth sticking a require in your script/server to see if it
helps.

FWIW, ldap works find under mongrel for me, I didn’t have to change a
thing…

Good luck,
Sandi