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.

ActionPack 2.3.5 gem declares incompatibility with rack 1.1.0

#3685

The issue is that actionpack-2.3.5 declares a gem dependency of ("rack", "~> 1.0.0"). This syntax indicates that the recently-released rack 1.1.0 is not compatible. Hence, rails attempts to load an earlier version of rack even if 1.1.0 is installed.

This can cause an application to fail to start in the following circumstance. With the following gems installed:

rails 2.3.5 (and dependencies)
rack 1.0.1 (a rails dependency)
rack 1.1.0
thin 1.2.5

Attempting to start rails on the thin webserver using "thin start --adapter rails" causes rails to erroneously report "Missing the Rails 2.3.5 gem". In fact, what has actually taken place is that thin has already loaded rack 1.1.0 (the latest version of rack). Rails then comes in and attempts to load an earlier version of rack such as 1.0.1, which causes a Gem::LoadError, leading boot.rb to report the error.

As a workaround for sites that are deployed using thin, we can hold off on installing rack 1.1.0. However, I believe actionpack's dependency declaration of ("rack", "~> 1.0.0") is in error.

Reported by Daniel Azuma · January 11th, 2010 @ 11:39 PM

State: invalid
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: Low

Activity

  1. Vivek Pandey
    Vivek Pandey

    Ditto! Same with GlassFish gem with rack (1.1.0, 1.0.1) and rails 2.3.4 or 2.3.5 results in to

    Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
    [Jan 12, 2010 10:18:20 AM] exit

    from /Users/vivek/dev/rails/bookstore/config/boot.rb:38:in `run'
    from /Users/vivek/dev/rails/bookstore/config/boot.rb:11:in `boot!'
    

    Reverting to rack 1.0.1 works just fine.

    January 12th, 2010 @ 08:01 PM

  2. Matt Jones
    Matt Jones

    There's also an issue where the gemspec specifies '~> 1.0.0', but the code actually calls gem 'rack' with a version of 1.0.1, meaning that installing 2.3.5 over 2.3.2 won't install a new Rack, but will fail. Ticket is #3558 Actionpack 2.3.5 gemspec and Rack requirement don't match - the fix for this will probably cover that as well.

    January 13th, 2010 @ 01:44 AM

  3. eveel
    eveel

    When I've uninstalled rack 1.1.0, everything began to work fine.

    Thanks, but this issue will be resolved, isn't it? :)

    January 13th, 2010 @ 11:34 AM

  4. Maximilian Schulz
    Maximilian Schulz

    Is there any update on the topic? I am just curious, because I would love to install a rails 3 beta application on the same server and it requires rack 1.1.0

    So right now I am not able to deploy the app as long as I still have any rails 2.3.5 apps running.

    February 10th, 2010 @ 09:08 AM

  5. Mihai Târnovan
    Mihai Târnovan

    '~> 1.0.0' means latest 1.0.x gem. So it would pick up 1.0.2 for example, but not 1.1.x

    February 24th, 2010 @ 05:44 PM

  6. Jimmy
    Jimmy

    Hi eveel,

    How to uninstall rack 1.1.0?
    Thanks

    February 28th, 2010 @ 10:30 PM

  7. bct
    bct
    • Tag changed from rack to actionpack, action_controller, rack

    I had the same problem as the original posters. Following information in this ticket, I found another workaround besides reverting to rack 1.0.1.

    In actionpack-2.3.5.gemspec, i changed every occurrence of a rack dependency declaration from "~> 1.0.0" to ">= 1.0.0" (there were 3 changes in the file, example...

    s.add_dependency(%q<rack>, ["~> 1.0.0"])
    

    changed to...

    s.add_dependency(%q<rack>, [">= 1.0.0"])
    

    )

    Also changed the code in actionpack (lib/action_controller.rb) and commented out line 34...

    gem 'rack', '>= 1.0.1'

    The very next line just requires rack anyway (require 'rack'). Those changes fixed the problem and I was able to start an app with 'thin start' again.

    I'm using version 2.3.5 rails, 1.2.6 thin. I didn't do ANY testing, so I'm sure I've broken several cardinal rules with this fix, but I got sick uninstalling rack everytime I do a gem update when this seems like such a simple (conceptually at least) problem to fix.

    March 1st, 2010 @ 04:40 PM

  8. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • State changed from new to invalid
    • Tag changed from actionpack, action_controller, rack to actionpack, action_controller, bundler, rack, rubygems
    • Milestone cleared.

    This problem is due to the way Rubygems activates dependencies. The easiest solution to this problem is to use bundler, which will determine the correct gems that you need, and only pull in those. This will guarantee that you won't have an activation error.

    March 27th, 2010 @ 10:31 AM

  9. jashkenas
    jashkenas

    Yehuda: That's not a satisfactory answer. You can't "just use bundler" if you're working on a gem or library that depends on ActiveRecord, and is meant to be used from other apps. This effectively kills Sinatra/ActiveRecord combinations unless you're willing to either patch your gems or needlessly downgrade your Rack.

    It would be great if you (Rails Core) could push out a 2.3.6 release of ActionPack and ActiveRecord that changes the fixed version ~> 1.0.0 to >= 1.0.0.

    March 29th, 2010 @ 08:30 PM

  10. rm
    rm
    • Tag cleared.

    bct's workaround from Mar 1 worked for me! Thanks bct.

    April 4th, 2010 @ 03:35 AM

  11. Chris Wise
    Chris Wise

    I have a really dumb question. In my Rails install, where do I find the gemspec in order to make a change? I need Rack 1.1.0 because I believe it fixes some bugs with read_multipart but I am running into the same issue described here when trying to live with actionpack 2.3.5.

    April 7th, 2010 @ 10:05 PM

  12. Chris Wise
    Chris Wise

    Apologies. I see it's in the RAKEFILE.

    April 7th, 2010 @ 10:09 PM

  13. ronin-95281 (at lighthouseapp)
    ronin-95281 (at lighthouseapp)

    Might I recommend that using bct's workaround posted on March 1, you should change the references to:

    ~> 1.0

    ... instead of:

    = 1.0.0

    This way it will allow any versions 1.x, but not any 2.x

    This could avoid major headaches down the line when rack 2.x comes out long form now and we don't even remember configuring any of this nonsense in the first place.

    Thoughts?

    -A.

    April 16th, 2010 @ 11:31 PM

  14. Kevin
    Kevin

    Worked for me once I upgraded to rails 2.3.8. I'm using thin 1.2.7.

    May 26th, 2010 @ 04:11 AM

  15. Chris Houhoulis
    Chris Houhoulis

    I used "ronin-95281 (at lighthouseapp)"'s advice, which built on bct's solution. Thanks!

    I want to second jashkenas's response to Yehuda. Yehuda, that was not a friendly or correct comment. Unless I am missing something, the problem was a minor bug in Rails: three typos in the rails files that bct mentioned. The easiest and most direct solution was to fix the typos. Why is that an "invalid" bug report?

    June 8th, 2010 @ 02:55 PM

  16. Alex Chaffee
    Alex Chaffee
    • Assigned user set to Yehuda Katz (wycats)

    Agreed. Fixing the three inaccurate dependency declarations in the gemspec did the trick for me. Yehuda, please reopen and reprioritize this bug, since (a) it's causing real pain for users, and (b) the declared dependency is just plain factually wrong: since actionpack works fine with rack 1.2, it should declare so.

    For the record (and for Chris Wise), on my system this file:

    /Library/Ruby/Gems/1.8/specifications/actionpack-2.3.8.gemspec

    now ends like this:

    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
      s.add_runtime_dependency(%q<activesupport>, ["= 2.3.8"])
      s.add_runtime_dependency(%q<rack>, ["~> 1.1"])
    else
      s.add_dependency(%q<activesupport>, ["= 2.3.8"])
      s.add_dependency(%q<rack>, ["~> 1.1"])
    end
    

    else

    s.add_dependency(%q<activesupport>, ["= 2.3.8"])
    s.add_dependency(%q<rack>, ["~> 1.1"])
    

    end end

    The patch is a simple matter of changing "1.1.0" to "1.1"

    June 15th, 2010 @ 11:49 PM

  17. tc
    tc
    • No changes were found…

    June 16th, 2010 @ 06:09 AM

  18. Alex Chaffee
    Alex Chaffee
    • Importance changed from to Low

    This bug is not invalid. How do we reopen it?

    July 18th, 2010 @ 08:04 PM

  19. Alex Chaffee
  20. Claus Lensbøl
    Claus Lensbøl

    I'm having the same issue after updating my gems.
    The problem for me does not affect my production environment, however with the amount of rails 2.x applications in use right now, I don't think that this should be 3.0 fix only.

    July 19th, 2010 @ 08:42 AM

  21. travis (at appoxy)
    travis (at appoxy)
    • Tag set to replica, watches

    I agree with the others, giving us the "use bundler" line is just wrong. Please reopen this ticket.

    August 19th, 2010 @ 02:10 AM

  22. Jeremy Kemper
  23. allsfashion
    allsfashion

    I'm having the same issue after updating my gems.please read this article www.5asale.com

    May 2nd, 2011 @ 06:23 AM