Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Error with multiple versions of Rack installed

#2717

I get the following error when multiple versions of Rack are present, specifically when Rack 1.0 is present:

undefined method 'new' for "Rack::Lock":String (NoMethodError)

I think this has to do with how Rails is loading the Rack dependency. For some reason, when Rack 1.0 and 0.9.1 are both installed, Rails uses Rack 0.9.1 instead of either the installed Rack 1.0 or the bundled Rack 1.0 in ActionPack.

I tried to do some debugging myself to see if I could find the actual code that causes this to take place, but alas, Rails code is a bit beyond my Ruby knowledge.

What I did find, however, is that because Rack 0.9 is being used instead of Rack 1.0, the klass method in ActionController::MiddlewareStack::Middleware#klass rescues the resulting NameError when attempting to constantize "Rack::Lock". Because the rescue code in the #klass just returns the current value of @klass, and because that value is the string "Rack::Lock" at the time, the "new" method is undefined, resulting in the above error.

If it helps, I'm using Passenger in my development environment which is where I see this taking place.

Dave Giunta

Reported by Dave Giunta · May 25th, 2009 @ 07:33 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to invalid

    If you update your passenger, this should be fixed. Or well, just uninstall older version of rack :)

    May 26th, 2009 @ 01:50 PM

  2. Dave Giunta
    Dave Giunta

    huh. well.. that did it. I wouldn't have guessed that the error was happening inside Passenger from the stacktrace. Crazy.

    Thanks!!

    May 26th, 2009 @ 03:35 PM