3scale / zync

Zync takes your 3scale data and pushes it somewhere else, reliably.
Apache License 2.0
19 stars 20 forks source link

ActiveRecord::StatementInvalid in bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:614 #60

Open mikz opened 7 years ago

mikz commented 7 years ago

Error in Zync

ActiveRecord::StatementInvalid in bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:614 PG::QueryCanceled: ERROR: canceling statement due to statement timeout CONTEXT: while locking tuple (9060,22) in relation "models" : SELECT "models".* FROM "models" WHERE "models"."id" = $1 LIMIT $2 FOR NO KEY UPDATE

View on Bugsnag

Stacktrace

bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:614 - async_exec
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:614 - block (2 levels) in exec_no_cache
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:46 - block in permit_concurrent_loads
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/concurrency/share_lock.rb:185 - yield_shares
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:45 - permit_concurrent_loads
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:613 - block in exec_no_cache
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:612 - block (2 levels) in log
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:611 - block in log
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/notifications/instrumenter.rb:21 - instrument
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:603 - log
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:612 - exec_no_cache
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:601 - execute_and_clear
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:79 - exec_query
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:371 - select
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:42 - select_all
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/query_cache.rb:97 - select_all
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/querying.rb:39 - find_by_sql
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation.rb:659 - exec_queries
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation.rb:546 - load
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation.rb:255 - records
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation/finder_methods.rb:518 - find_take
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation/finder_methods.rb:100 - take
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation/finder_methods.rb:468 - find_one
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation/finder_methods.rb:450 - find_with_ids
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation/finder_methods.rb:66 - find
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/persistence.rb:460 - block in reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/scoping/default.rb:35 - block in unscoped
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/relation.rb:336 - scoping
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/scoping/default.rb:35 - unscoped
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/persistence.rb:460 - reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/attribute_methods/dirty.rb:50 - reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/associations.rb:283 - reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/autosave_association.rb:236 - reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/aggregations.rb:13 - reload
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/locking/pessimistic.rb:70 - lock!
app/models/model.rb:13 - weak_lock
app/models/update_state.rb:10 - block in acquire_lock
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:235 - block in transaction
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/transaction.rb:194 - block in within_new_transaction
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/transaction.rb:191 - within_new_transaction
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:235 - transaction
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/transactions.rb:210 - transaction
app/models/update_state.rb:9 - acquire_lock
app/jobs/update_job.rb:19 - perform
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/execution.rb:37 - block in perform_now
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:108 - block in run_callbacks
bundle/ruby/2.4.0/gems/i18n-0.8.6/lib/i18n.rb:257 - with_locale
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/translation.rb:7 - block (2 levels) in <module:Translation>
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - instance_exec
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - block in run_callbacks
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/logging.rb:24 - block (4 levels) in <module:Logging>
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/notifications.rb:166 - block in instrument
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/notifications/instrumenter.rb:21 - instrument
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/notifications.rb:166 - instrument
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/logging.rb:23 - block (3 levels) in <module:Logging>
lib/lograge/job_log_subscriber.rb:14 - tag_logger
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/logging.rb:20 - block (2 levels) in <module:Logging>
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - instance_exec
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - block in run_callbacks
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:135 - run_callbacks
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/execution.rb:33 - perform_now
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/execution.rb:22 - block in execute
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:108 - block in run_callbacks
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/railtie.rb:26 - block (4 levels) in <class:Railtie>
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/execution_wrapper.rb:85 - wrap
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/reloader.rb:68 - block in wrap
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/execution_wrapper.rb:81 - wrap
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/reloader.rb:67 - wrap
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/railtie.rb:25 - block (3 levels) in <class:Railtie>
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - instance_exec
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:117 - block in run_callbacks
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/callbacks.rb:135 - run_callbacks
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/execution.rb:20 - execute
bundle/ruby/2.4.0/gems/activejob-5.1.3/lib/active_job/queue_adapters/que_adapter.rb:32 - run
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/job.rb:17 - _run
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/job.rb:129 - block in work
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/adapters/active_record.rb:7 - block in checkout
bundle/ruby/2.4.0/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:408 - with_connection
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/adapters/active_record.rb:67 - block in checkout_activerecord_adapter
bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/execution_wrapper.rb:85 - wrap
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/adapters/active_record.rb:66 - checkout_activerecord_adapter
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/adapters/active_record.rb:7 - checkout
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/job.rb:111 - work
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/worker.rb:80 - block in work_loop
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/worker.rb:75 - loop
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/worker.rb:75 - work_loop
bundle/ruby/2.4.0/gems/que-0.13.1/lib/que/worker.rb:19 - block in initialize

View full stacktrace

Created by 3scale via Bugsnag

mikz commented 7 years ago

It is possible that because of timeouts in https://github.com/3scale/zync/issues/59 the job processing takes some time. Looks like the weak locking does not work properly and still can timeout.