This project is archived and is in readonly mode.

#3685 ✓invalid
Daniel Azuma

ActionPack 2.3.5 gem declares incompatibility with rack 1.1.0

Reported by Daniel Azuma | January 11th, 2010 @ 11:39 PM | in 3.0.2

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.

Comments and changes to this ticket

  • Vivek Pandey

    Vivek Pandey January 12th, 2010 @ 08:01 PM

    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.

  • Matt Jones

    Matt Jones January 13th, 2010 @ 01:44 AM

    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 - the fix for this will probably cover that as well.

  • eveel

    eveel January 13th, 2010 @ 11:34 AM

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

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

  • Maximilian Schulz

    Maximilian Schulz February 10th, 2010 @ 09:08 AM

    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.

  • Mihai Târnovan

    Mihai Târnovan February 24th, 2010 @ 05:44 PM

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

  • Jimmy

    Jimmy February 28th, 2010 @ 10:30 PM

    Hi eveel,

    How to uninstall rack 1.1.0?
    Thanks

  • bct

    bct March 1st, 2010 @ 04:40 PM

    • 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.

  • Yehuda Katz (wycats)

    Yehuda Katz (wycats) March 27th, 2010 @ 10:31 AM

    • 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.

  • jashkenas

    jashkenas March 29th, 2010 @ 08:30 PM

    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.

  • rm

    rm April 4th, 2010 @ 03:35 AM

    • Tag cleared.

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

  • Chris Wise

    Chris Wise April 7th, 2010 @ 10:05 PM

    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.

  • Chris Wise

    Chris Wise April 7th, 2010 @ 10:09 PM

    Apologies. I see it's in the RAKEFILE.

  • ronin-95281 (at lighthouseapp)

    ronin-95281 (at lighthouseapp) April 16th, 2010 @ 11:31 PM

    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.

  • Kevin

    Kevin May 26th, 2010 @ 04:11 AM

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

  • Chris Houhoulis

    Chris Houhoulis June 8th, 2010 @ 02:55 PM

    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?

  • Alex Chaffee

    Alex Chaffee June 15th, 2010 @ 11:49 PM

    • 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"

  • tc

    tc June 16th, 2010 @ 06:09 AM

    • no changes were found...
  • Alex Chaffee

    Alex Chaffee July 18th, 2010 @ 08:04 PM

    • Importance changed from “” to “Low”

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

  • Alex Chaffee
  • Claus Lensbøl

    Claus Lensbøl July 19th, 2010 @ 08:42 AM

    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.

  • travis (at appoxy)

    travis (at appoxy) August 19th, 2010 @ 02:10 AM

    • Tag set to replica, watches

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

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
  • allsfashion

    allsfashion May 2nd, 2011 @ 06:23 AM

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

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>

Attachments

Referenced by

Pages