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!
-
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..
-
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:migrateEdit 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 endRun the server...
script/serverOpen up your browser...
http://localhost:3000/testWow, 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
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
I get same errors as well. (True for all controllers. Strange).
-
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...)
-
Tom Stuart
Same problem here. Reverted.
-
dust
- Assigned user set to josh
- Tag set to 2.3.3, rack, reloading
-
Luismi Cavallé
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
When deployed there is no problem. Could have something to do with rails environment as well.
-
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.
-
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 !
-
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.
-
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.
-
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:
-
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... -
josh
- Assigned user cleared.
-
Prem Sichanugrist (sikachu)
Should this one be marked as duplicate of #2873 again?
-
Prem Sichanugrist (sikachu)
- State changed from incomplete to duplicate