# Ruby-ldap crashing WEBrick server

**URL:** <https://www.ruby-forum.com/t/ruby-ldap-crashing-webrick-server/58376>\
**Category:** Rails\
**Created:** [April 21, 2006, 12:46am UTC](https://www.ruby-forum.com/t/ruby-ldap-crashing-webrick-server/58376 "2006-04-21T00:46:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [April 21, 2006, 12:46am UTC](https://www.ruby-forum.com/t/ruby-ldap-crashing-webrick-server/58376/1 "2006-04-21T00:46:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [April 21, 2006, 1:33am UTC](https://www.ruby-forum.com/t/ruby-ldap-crashing-webrick-server/58376/2 "2006-04-21T01:33:49Z")

</div>

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
