Ho un progetto Rails che, di tanto in tanto, genera questa eccezione nella produzione, in modo non riproducibile. Tutto funziona bene in fase di sviluppo e test, e apparentemente anche in produzione, ma ExceptionNotifier ogni qualche settimana mi invia con questa eccezione ...Intermittente "Dipendenze circolari rilevate durante l'autoloading costante" errori di produzione
Non ho idea di cosa sta succedendo, quindi ho intenzione di scaricare quante più informazioni sul mio ambiente che ritengo sia rilevante, nella speranza che parte di ciò possa aiutare a risolverlo. (. Cioè non JRuby)
- di Ruby 2.1.5
- Rails 4.2.1
- Running in Heroku, con regolare Rubino interprete
L'errore completo è:
"Circular dependency detected while autoloading constant DeferredUpdatesHelper"
DeferredUpdatesHelper
è un modulo definito in lib/deferred_updates_helper.rb
, come tale:
module DeferredUpdatesHelper
def self.something_something(params)
end
end
Non riesco a pensare a nessuna dipendenza di questo modulo. È molto semplice, e per quanto posso dire, tutto ciò di cui ha bisogno è una variabile globale chiamata $ RedisPool, quindi non sono sicuro di come possa esserci una dipendenza circolare ...
Questo modulo è utilizzato da uno dei miei modelli: models/user.rb
class User < ActiveRecord::Base
def self.process_deferred_something
DeferredUpdatesHelper.something_something(params) do
# do stuff
end
end
end
Questo metodo viene chiamato da un ActiveJob:
class SomeJob < ActiveJob::Base
queue_as :default
def perform
User.process_deferred_something
end
end
che viene eseguito all'interno di un processo Sidekiq, e funziona perfettamente felicemente ogni 10 minuti, solo che ogni tanto ottengo una delle questi ...
Non c'è nessuna istruzione require
da nessuna parte, o almeno in nessuno di questi file menzionati ... E come accennato, in dev tutto funziona e basta.
dello stack:
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:492:in `load_missing_constant'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:526:in `load_missing_constant'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
/app/app/models/user.rb:93:in `process_deferred_something'
/app/app/jobs/some_job.rb:5:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:32:in `block in perform_now'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:46:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:46:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:20:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `block in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `block in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:23:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:43:in `block in tag_logger'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:43:in `tag_logger'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `block in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `block in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_perform_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:31:in `perform_now'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:21:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:40:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:75:in `execute_job'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/app/lib/sidekiq_monitoring.rb:46:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/sidekiq.rb:33:in `block in call'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:353:in `perform_action_with_newrelic_trace'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/sidekiq.rb:29:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/logging.rb:24:in `with_context'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:132:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:51:in `block in process'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:98:in `stats'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:50:in `process'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
Qualsiasi idea di quello che potrebbe essere in corso, o come posso risolvere il problema?
Hai mai scoperto come risolvere questo problema? – Pwnna
No, succede ancora, in produzione, di tanto in tanto ... –
Ho anche questo problema. Ho correlato gli errori a volte quando il processo si riavvia (succede solo durante questo, ma non necessariamente sempre). È vero anche per te? Vedo che stai utilizzando Rails42, puoi controllare se https://github.com/rails/rails/commit/ae07806858072cd66611c165d1eed2a113e639e5 è applicato al tuo ramo? Non posso ancora eseguire l'aggiornamento a 42, quindi non ho questa patch. – Pwnna