错误:
ActiveRecord::StatementInvalid: PG::Error: connection not open : UPDATE "delayed_jobs" SET locked_by = null, locked_at = null WHERE (locked_by = '...')
它发生在佣金工作中:为在heroku部署的应用程序工作并使用postgres数据库。 Backtrace没有向我提供有关导致失败的任务的任何信息:
activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:1153→ async_exec
activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:1153→ exec_no_cache
activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:673→ block in exec_delete
activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:280→ block in log
activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20→ instrument
activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:275→ log
newrelic_rpm-3.3.3/lib/new_relic/agent/instrumentation/active_record.rb:31→ block in log_with_newrelic_instrumentation
newrelic_rpm-3.3.3/lib/new_relic/agent/method_tracer.rb:242→ trace_execution_scoped
newrelic_rpm-3.3.3/lib/new_relic/agent/instrumentation/active_record.rb:28→ log_with_newrelic_instrumentation
activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:672→ exec_delete
activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:96→ update
activerecord-3.2.12/lib/active_record/connection_adapters/abstract/query_cache.rb:14→ update
activerecord-3.2.12/lib/active_record/relation.rb:294→ update_all
activerecord-3.2.12/lib/active_record/relation.rb:278→ update_all
activerecord-3.2.12/lib/active_record/querying.rb:7→ update_all
delayed_job_active_record-0.3.2/lib/delayed/backend/active_record.rb:44→ clear_locks!
delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:9→ ensure in block (2 levels) in <class:ClearLocks>
delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:9→ block (2 levels) in <class:ClearLocks>
delayed_job-3.0.3/lib/delayed/lifecycle.rb:78→ call
delayed_job-3.0.3/lib/delayed/lifecycle.rb:78→ block (2 levels) in add
delayed_job-3.0.3/lib/delayed/lifecycle.rb:60→ call
delayed_job-3.0.3/lib/delayed/lifecycle.rb:60→ block in initialize
delayed_job-3.0.3/lib/delayed/lifecycle.rb:78→ call
delayed_job-3.0.3/lib/delayed/lifecycle.rb:78→ block in add
delayed_job-3.0.3/lib/delayed/lifecycle.rb:65→ call
delayed_job-3.0.3/lib/delayed/lifecycle.rb:65→ execute
delayed_job-3.0.3/lib/delayed/lifecycle.rb:38→ run_callbacks
delayed_job-3.0.3/lib/delayed/worker.rb:127→ start
delayed_job-3.0.3/lib/delayed/tasks.rb:9→ block (2 levels) in <top (required)>
rake-10.0.3/lib/rake/task.rb:228→ call
rake-10.0.3/lib/rake/task.rb:228→ block in execute
rake-10.0.3/lib/rake/task.rb:223→ each
rake-10.0.3/lib/rake/task.rb:223→ execute
rake-10.0.3/lib/rake/task.rb:166→ block in invoke_with_call_chain
/usr/local/lib/ruby/1.9.1/monitor.rb:201→ mon_synchronize
rake-10.0.3/lib/rake/task.rb:159→ invoke_with_call_chain
rake-10.0.3/lib/rake/task.rb:152→ invoke
rake-10.0.3/lib/rake/application.rb:143→ invoke_task
rake-10.0.3/lib/rake/application.rb:101→ block (2 levels) in top_level
rake-10.0.3/lib/rake/application.rb:101→ each
rake-10.0.3/lib/rake/application.rb:101→ block in top_level
rake-10.0.3/lib/rake/application.rb:110→ run_with_threads
rake-10.0.3/lib/rake/application.rb:95→ top_level
rake-10.0.3/lib/rake/application.rb:73→ block in run
rake-10.0.3/lib/rake/application.rb:160→ standard_exception_handling
rake-10.0.3/lib/rake/application.rb:70→ run
rake-10.0.3/bin/rake:33→ <top (required)>
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/bin/rake:19→ load
[PROJECT_ROOT]/vendor/bundle/ruby/1.9.1/bin/rake:19→ <main>
所以我猜它是在环境设置期间发生的。 有什么帮助吗?
答案 0 :(得分:1)
您似乎正在使用new relic
,似乎此问题的已知问题看起来here和here on github
对于解决方案,也许你可以使用一些替代解决方案。看看这个问题https://stackoverflow.com/questions/4840319/cheaper-alternatives-to-new-relic它可能会对你有所帮助。相反,您可以尝试https://www.scoutapp.com/
另请参阅本文http://drewblas.com/2008/05/29/comparison-of-rails-monitoring-apps/并确定最适合您的解决方案。
如果您需要任何其他帮助,请告诉我
答案 1 :(得分:0)