Skip to content

Circular dependency detected while autoloading constant HighVoltage::PagesController #68

Closed
mathias opened this Issue Mar 7, 2013 · 5 comments

4 participants

@mathias
mathias commented Mar 7, 2013

I get this occasionally error & stacktrace until I restart the server.

My setup is:

config/initializers/high_voltage.rb:

HighVoltage.routes = false

config/routes.rb:

  root to: 'high_voltage/pages#show', id: 'home'

Ruby 2.0, Rails 4.0, Puma. Guessing it is one of these that is causing this. I have high hopes though, as it is working most of the time.

Here's the backtrace:

activesupport (4.0.0.beta1) lib/active_support/dependencies.rb:460:in `load_missing_constant'
activesupport (4.0.0.beta1) lib/active_support/dependencies.rb:183:in `const_missing'
activesupport (4.0.0.beta1) lib/active_support/inflector/methods.rb:228:in `const_get'
activesupport (4.0.0.beta1) lib/active_support/inflector/methods.rb:228:in `block in constantize'
activesupport (4.0.0.beta1) lib/active_support/inflector/methods.rb:224:in `each'
activesupport (4.0.0.beta1) lib/active_support/inflector/methods.rb:224:in `inject'
activesupport (4.0.0.beta1) lib/active_support/inflector/methods.rb:224:in `constantize'
activesupport (4.0.0.beta1) lib/active_support/dependencies.rb:534:in `get'
activesupport (4.0.0.beta1) lib/active_support/dependencies.rb:565:in `constantize'
actionpack (4.0.0.beta1) lib/action_dispatch/routing/route_set.rb:74:in `controller_reference'
actionpack (4.0.0.beta1) lib/action_dispatch/routing/route_set.rb:64:in `controller'
actionpack (4.0.0.beta1) lib/action_dispatch/routing/route_set.rb:42:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/journey/router.rb:69:in `block in call'
actionpack (4.0.0.beta1) lib/action_dispatch/journey/router.rb:57:in `each'
actionpack (4.0.0.beta1) lib/action_dispatch/journey/router.rb:57:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/routing/route_set.rb:651:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/cookies.rb:452:in `call'
activerecord (4.0.0.beta1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:632:in `call'
activerecord (4.0.0.beta1) lib/active_record/migration.rb:348:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0.beta1) lib/active_support/callbacks.rb:373:in `_run__3671050253250555323__call__callbacks'
activesupport (4.0.0.beta1) lib/active_support/callbacks.rb:78:in `run_callbacks'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0.beta1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0.beta1) lib/rails/engine.rb:510:in `call'
railties (4.0.0.beta1) lib/rails/application.rb:96:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
puma (1.6.3) lib/puma/server.rb:412:in `handle_request'
puma (1.6.3) lib/puma/server.rb:306:in `process_client'
puma (1.6.3) lib/puma/server.rb:215:in `block in run'
puma (1.6.3) lib/puma/thread_pool.rb:94:in `call'
puma (1.6.3) lib/puma/thread_pool.rb:94:in `block in spawn_thread'

Thank you!

@harlow
harlow commented Mar 8, 2013

@mathias thanks for the note. It may be a rails 4 issue. I should have some time tomorrow to test it out against rails 4.

@fdeschenes

Any update on this issue?

@croaky
thoughtbot, inc. member
croaky commented Mar 17, 2013

This looks similar to thoughtbot/clearance#276. Both are Rails 4, Ruby 2, pull servers (Puma or Unicorn), and Rails engines with controllers that use unloadable.

@harlow
harlow commented Mar 18, 2013

@croaky nice find. I'll look into that... With that said, I haven't haven't been able to replicate this locally yet. @mathias are you able to get this error in your local dev environment?

@croaky
thoughtbot, inc. member
croaky commented Mar 18, 2013

@harlow These steps should re-create the issue:

[~/dev] rbenv shell 2.0.0-p0
[~/dev] rails -v
Rails 4.0.0.beta1
[~/dev] rails new high-voltage-test
[~/dev] cd high-voltage-test
[~/dev/high-voltage-test] cat Gemfile
source 'https://rubygems.org'

gem 'high_voltage'
gem 'jbuilder', '~> 1.0.1'
gem 'jquery-rails'
gem 'rails', '4.0.0.beta1'
gem 'sqlite3'
gem 'turbolinks'
[~/dev/high-voltage-test] bundle
[~/dev/high-voltage-test] mkdir app/views/pages
[~/dev/high-voltage-test] echo "Sup" > app/views/pages/anything.html.erb
[~/dev/high-voltage-test] rails server

Open browser, see the "Sup".

Then, create a app/models/user.rb:

class User
end

Reload the page, see Circular dependency detected while autoloading constant HighVoltage::PagesController

@croaky croaky closed this Mar 18, 2013
@jasnow jasnow pushed a commit that referenced this issue Dec 13, 2015
@harlow harlow Remove unloadable from controller 8204c74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.