Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby-ldap gem not work in rails3 app, but works in rails console #14

Open
i3zhe opened this issue Aug 16, 2012 · 3 comments
Open

ruby-ldap gem not work in rails3 app, but works in rails console #14

i3zhe opened this issue Aug 16, 2012 · 3 comments

Comments

@i3zhe
Copy link

i3zhe commented Aug 16, 2012

I want to build a rails3 website authed with LDAP, so I chose ruby-ldap gem (not net/ldap) which we used in our old rails2 apps and works very well.

But I keep on getting weird error in rails3 app, See the codes below:

require 'ldap'
class WelcomeController < ApplicationController

  def index  
    begin
      @test = LDAP::Conn.new('10.72.64.11', 389)
    rescue LDAP::Error
      p LDAP::Error
    end  
    render :text => "ok"
  end
end 

welcome#index is my root route. Most time, the app crashes when going to LDAP::Conn.new('10.72.64.11', 389), even I tried to use "pry" to debug and track, throwing

[1] 24797 trace trap rails s

and the WEBrick server will be terminated right that time.

Sometimes it throws another type error when I use "pry" to step,
#<NameError: uninitialized constant WelcomeController::LDAP>

While try it in the console, everything goes well.

    1.9.3-p194 :001 > require 'ldap'
     => true 
    1.9.3-p194 :002 > @test = LDAP::Conn.new('10.72.64.11', 389)
     => #<LDAP::Conn:0x00000101289568> 
    1.9.3-p194 :003 > 
@i3zhe
Copy link
Author

i3zhe commented Aug 16, 2012

I am using rails 3.2.8

@Folkman
Copy link

Folkman commented Jul 31, 2013

I got the same error using Webrick. Using Unicorn worked though... maybe it has to do with threading?

@xoryves
Copy link

xoryves commented Mar 12, 2018

Yes, it seems to be a threding problem, because of linking against libldap.
I get seg faults when used with puma.
See issue #13 and pull #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants