You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Queue enough resque jobs that have to connect to the database, and this appears to occur sporadically. I haven't been able to nail down any precise cause. This seems to happen most often with ActiveStorage::PurgeJobs, but that could be just because they are common. It also happens with other Rails-specific and custom jobs alike.
Expected behavior
Jobs should be able to fetch the records they need to perform the job and continue without a problem in every case.
Actual behavior
About one job in a thousand results in this error:
undefined method `[]' for nil:NilClass
/srv/app/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:389:in `active_connection?'
/srv/app/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/query_cache.rb:36:in `enable_query_cache!'
/srv/app/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/query_cache.rb:32:in `block in run'
/srv/app/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/query_cache.rb:29:in `map'
/srv/app/shared/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/query_cache.rb:29:in `run'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:27:in `before'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:605:in `catch'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:605:in `block in default_terminator'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:199:in `block in halting'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:513:in `each'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:513:in `invoke_before'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:131:in `run_callbacks'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:110:in `run!'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:72:in `block in run!'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:69:in `tap'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:69:in `run!'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:85:in `wrap'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/reloader.rb:72:in `wrap'
/srv/app/shared/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/railtie.rb:27:in `block (3 levels) in <class:Railtie>'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `instance_exec'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/srv/app/shared/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:136:in `run_callbacks'
/srv/app/shared/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/execution.rb:22:in `execute'
/srv/app/shared/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/queue_adapters/resque_adapter.rb:47:in `perform'
Retrying the job manually seems to work.
System configuration
Rails version: 5.2.0
Ruby version: 2.5.1
The text was updated successfully, but these errors were encountered:
CodingAnarchy
changed the title
Rescue jobs failing for missing AR connection on Rails 5.2
Resque jobs failing for missing AR connection on Rails 5.2
Jun 8, 2018
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 5-2-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
Steps to reproduce
Queue enough resque jobs that have to connect to the database, and this appears to occur sporadically. I haven't been able to nail down any precise cause. This seems to happen most often with
ActiveStorage::PurgeJob
s, but that could be just because they are common. It also happens with other Rails-specific and custom jobs alike.Expected behavior
Jobs should be able to fetch the records they need to perform the job and continue without a problem in every case.
Actual behavior
About one job in a thousand results in this error:
Retrying the job manually seems to work.
System configuration
Rails version: 5.2.0
Ruby version: 2.5.1
The text was updated successfully, but these errors were encountered: