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!
Reported by info (at tomrothe) | July 24th, 2009 @ 04:42 PM | in 2.3.6
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:in
const_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.
Comments and changes to this ticket
-
dust July 24th, 2009 @ 11:12 PM
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..
-
Flip Sasser July 25th, 2009 @ 02:51 AM
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
-
Flip Sasser July 25th, 2009 @ 03:19 AM
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
-
Katherine G Pe July 27th, 2009 @ 02:05 PM
I get same errors as well. (True for all controllers. Strange).
-
Luismi Cavallé July 27th, 2009 @ 05:37 PM
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...)
-
dust July 28th, 2009 @ 04:01 PM
- Assigned user set to josh
- Tag set to 2.3.3, rack, reloading
-
Luismi Cavallé July 29th, 2009 @ 07:59 AM
Looks like this only happens using script/server. Starting the server with "mongrel_rails start" seems to work. Anyone can confirm this?
-
Katherine G Pe July 29th, 2009 @ 08:09 AM
When deployed there is no problem. Could have something to do with rails environment as well.
-
andyjeffries July 29th, 2009 @ 10:23 AM
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.
-
Raphael Emourgeon July 29th, 2009 @ 05:53 PM
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 !
-
Nate July 29th, 2009 @ 08:44 PM
Looks like this only happens using script/server. Starting the server with "mongrel_rails start" seems to work. > Anyone can confirm this?
I confirm.
-
Michael Koziarski July 31st, 2009 @ 07:14 AM
- 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.
-
Michael Koziarski July 31st, 2009 @ 07:17 AM
- 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:
-
Repository August 1st, 2009 @ 09:28 PM
- 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... -
josh August 19th, 2009 @ 03:56 PM
- Assigned user cleared.
-
Jeremy Kemper September 11th, 2009 @ 11:04 PM
- Milestone changed from 2.3.4 to 2.3.6
[milestone:id#50064 bulk edit command]
-
Prem Sichanugrist (sikachu) January 21st, 2010 @ 06:06 AM
Should this one be marked as duplicate of #2873 again?
-
Prem Sichanugrist (sikachu) January 22nd, 2010 @ 08:55 AM
- State changed from incomplete to duplicate
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
Referenced by
- 2873 Application reloading should be deferred to end of request, currently interferes with 'render :text => lambda { ... }' streaming Pulling this back to 2.3 until we tidy up the error repor...
- 2948 Exception: A copy of ActorsController has been removed from the module tree but is still active! [#2948 state:incomplete]