This project is archived and is in readonly mode.

#2717 ✓invalid
Dave Giunta

Error with multiple versions of Rack installed

Reported by Dave Giunta | May 25th, 2009 @ 07:33 PM | in 2.x

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

Comments and changes to this ticket

  • Pratik

    Pratik May 26th, 2009 @ 01:50 PM

    • State changed from “new” to “invalid”

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

  • Dave Giunta

    Dave Giunta May 26th, 2009 @ 03:35 PM

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

    Thanks!!

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages