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.

Exception: A copy of ActorsController has been removed from the module tree but is still active!

#2948

Under windows i constantly get this error since i upgraded to version 2.3.3:

A copy of ActorsController has been removed from the module tree but is still active!

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:414:in load_missing_constant'<br/> c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:96:inconst_missing'
XXX/app/controllers/XXX_controller.rb:78:in some_before_filter'

if i use 2.3.2 there is no problem at all2

unfortunately, i can't reproduce the error to happen every time i request a page, it only occurs sometimes.

there is a little discussion on this topic in the comments of the 2.3.3 release blog post (http://weblog.rubyonrails.org/2009/7/20/rails-2-3-3-touching-faster...)

i updated my rubygems to version 1.3.5 but no success.

Reported by info (at tomrothe) · July 24th, 2009 @ 04:42 PM

State: duplicate
Milestone: 2.3.6
Assigned to: nobody
Importance: none

Activity

  1. dust
    dust

    I hit this issue yesterday. git-bisect tells me that http://github.com/rails/rails/commit/bc2c4a45959be21e6314fba7876b32... is the commit that begins to cause this issue for me, which makes sense as it changes when connections are closed - and I presume - classes reloaded while in development mode using mongrel.

    I haven't been able to come up with a reproducible case yet, but I'll plug away at it a bit more. In short though, we have a page that makes a bunch of ajax calls to different actions on the same controller, each of which start somewhat lengthy queries through different models. After the first request to return results renders, the rest die in short order by any number of errors: nil objects, stack level too deep errors, missing classes, missing methods, etc..

    July 24th, 2009 @ 11:12 PM

  2. Flip Sasser
    Flip Sasser

    I can replicate this one. Try this (on 2.3.3):

    rails test
    cd test
    script/generate metal test
    script/generate model user
    rake db:migrate
    

    Edit app/metal/test.rb and change from "Hello, World!" to User.inspect:

    # Allow the metal piece to run in isolation
    require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
    
    class Test
      def self.call(env)
        if env["PATH_INFO"] =~ /^\/test/
          [200, {"Content-Type" => "text/html"}, [User.inspect]]
        else
          [404, {"Content-Type" => "text/html"}, ["Not Found"]]
        end
      end
    end
    

    Run the server...

    script/server
    

    Open up your browser...

    http://localhost:3000/test
    

    Wow, it works! Now hit refresh...

    Red Text of Doom!

    The raise is happening here:

    activesupport-2.3.3/lib/active_support/dependencies.rb:414:in `load_missing_constant'
    

    ... and I guess it has something to do with development mode's object reloading. Check it:

    rake db:migrate RAILS_ENV=production
    script/server -e production
    

    ... and that thing just works!

    It's a trivial fix to those of you who can't patch it (like me): go back to 2.3.2. Everything seems peachy there!

    Flip

    July 25th, 2009 @ 02:51 AM

  3. Flip Sasser
    Flip Sasser

    Okay, so I found a workaround and part of the cause. The const_missing mixin from ClassConstMissing (dependencies.rb:89) is firing any time the User class is referenced (like requiring authentication, for example), from multiple modules and/or classes (ApplicationController, AdminController, APIMetal, etc). For whatever reason, the middleware approach throws this error when referencing a class, because it basically gets wired up in the context of said middleware - APIMetal::User. Which (I'm guessing now) might not get auto-unloaded.

    At least that's my imperfect understanding of the problem.

    Why that is or what the patch would look like I still don't know (maybe auto-unload metals in development; I'll check that out), but basically the workaround is to prepend your app's class names with :: to force the context back out to the Object (the module, not the concept) level, which Rails will in turn load the class under, which will solve the problem - at least in any Rack-based applications.

    SO:

    [200, {"Content-Type" => "text/html"}, [User.inspect]]
    

    Would become:

    [200, {"Content-Type" => "text/html"}, [::User.inspect]]
    

    The broader problem I am still working on, but doubt I will figure out how to fix for a while. Sorry to those of you having this problem outside of middleware - that part is beyond me!

    Flip

    July 25th, 2009 @ 03:19 AM

  4. Katherine G Pe
    Katherine G Pe

    I get same errors as well. (True for all controllers. Strange).

    July 27th, 2009 @ 02:05 PM

  5. Luismi Cavallé
    Luismi Cavallé

    I also get the same kind of errors when concurrent requests are made (hitting repeateadly refresh in the browser is enough sometimes to reproduce it). It looks like I only get the errors using mongrel, with webrick, thin or passenger, everything seems to work fine.

    My workaround is bringing back the old reloader.rb (http://github.com/rails/rails/blob/29c59858492d44cc737e1f0b944a51fe...)

    July 27th, 2009 @ 05:37 PM

  6. Tom Stuart
    Tom Stuart

    Same problem here. Reverted.

    July 28th, 2009 @ 10:28 AM

  7. dust
    dust
    • Assigned user set to josh
    • Tag set to 2.3.3, rack, reloading

    July 28th, 2009 @ 04:01 PM

  8. Luismi Cavallé
    Luismi Cavallé

    Looks like this only happens using script/server. Starting the server with "mongrel_rails start" seems to work. Anyone can confirm this?

    July 29th, 2009 @ 07:59 AM

  9. Katherine G Pe
    Katherine G Pe

    When deployed there is no problem. Could have something to do with rails environment as well.

    July 29th, 2009 @ 08:09 AM

  10. andyjeffries
    andyjeffries

    We're also getting this error on Passenger 2.2.4. We're using Rails Metal and Rails Middleware which from murmurings on the net seem to be a common point.

    July 29th, 2009 @ 10:23 AM

  11. Raphael Emourgeon
    Raphael Emourgeon

    Looks like this only happens using script/server. Starting the server with "mongrel_rails start" seems to work. Anyone can confirm this?

    Yes I confirm !

    July 29th, 2009 @ 05:53 PM

  12. Nate
    Nate

    Looks like this only happens using script/server. Starting the server with "mongrel_rails start" seems to work. > Anyone can confirm this?

    I confirm.

    July 29th, 2009 @ 08:44 PM

  13. Michael Koziarski
    Michael Koziarski
    • Milestone changed from 2.x to 2.3.4

    Reloading is completely unsupported (and unsupportable) for concurrent requests, bugs you're seeing related to reloading or concurrent requests are not something we're going to be able fix.

    I'm guessing the problem here is that the ensure block meant that reloading happened within Rack::Lock or similar, and now we're not using a mutex to protect it.

    July 31st, 2009 @ 07:14 AM

  14. Michael Koziarski
    Michael Koziarski
    • State changed from new to duplicate

    In fact, I'm going to resolve this as duplicate, and reopen the original ticket with a view to reverting it:

    #2873

    July 31st, 2009 @ 07:17 AM

  15. Repository
    Repository
    • State changed from duplicate to incomplete

    (from [d37ac7958fc88fdbf37a8948102f6b4e45c530b3]) Make the new code reloading behavior work with multithreaded environments such as Mongrel.

    [#2948 state:incomplete]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/d37ac7958fc88fdbf37a8948102f6b...

    August 1st, 2009 @ 09:28 PM

  16. josh
    josh
    • Assigned user cleared.

    August 19th, 2009 @ 03:56 PM

  17. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.4 to 2.3.6

    [milestone:id#50064 bulk edit command]

    September 11th, 2009 @ 11:04 PM

  18. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)

    Should this one be marked as duplicate of #2873 again?

    January 21st, 2010 @ 06:06 AM

  19. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • State changed from incomplete to duplicate

    January 22nd, 2010 @ 08:55 AM

  20. bingbing