Topic: Hey admins. You might want to see this

Posted under General

This topic has been locked.

Just adding a tag to a post and got this

ActiveRecord::StatementInvalid in PostController#update

PGError: ERROR: deadlock detected
DETAIL: Process 30164 waits for ShareLock on transaction 820013141; blocked by process 30167.
Process 30167 waits for ShareLock on transaction 820013140; blocked by process 30164.
HINT: See server log for query details.
CONTEXT: SQL statement "UPDATE tags SET post_count = post_count - 1 WHERE tags.id = OLD.tag_id"
PL/pgSQL function trg_posts_tags__delete() line 3 at SQL statement
: DELETE FROM posts_tags WHERE post_id = 262740
RAILS_ROOT: /home/e621/e621-production

Application Trace | Framework Trace | Full Trace
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract_adapter.rb:227:in log' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/postgresql_adapter.rb:520:in execute'
/home/e621/e621-production/lib/core_extensions.rb:8:in __send__' /home/e621/e621-production/lib/core_extensions.rb:8:in execute_sql'
/home/e621/e621-production/app/models/post_methods/tag_methods.rb:170:in commit_tags' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:182:in transaction' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:188:in transaction'
/home/e621/e621-production/app/models/post_methods/tag_methods.rb:80:in commit_tags' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:178:in send'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:178:in evaluate_method' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:166:in call'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:93:in run' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in each'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:92:in run'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/callbacks.rb:276:in run_callbacks' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/callbacks.rb:344:in callback'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/callbacks.rb:251:in create_or_update' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/base.rb:2585:in save_without_validation'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/validations.rb:1089:in save_without_dirty' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/dirty.rb:79:in save_without_transactions'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in with_transaction_returning_status'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:182:in transaction'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:228:in with_transaction_returning_status' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:196:in save'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:208:in rollback_active_record_state!' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:196:in save'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/base.rb:2680:in update_attributes_inside_transaction' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in send'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:229:in with_transaction_returning_status' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:182:in transaction' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/transactions.rb:228:in with_transaction_returning_status'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activerecord-2.3.18/lib/active_record/base.rb:2675:in update_attributes' /home/e621/e621-production/app/controllers/post_controller.rb:277:in update'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:1333:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:1333:in perform_action_without_filters'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:617:in call_filters' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:610:in perform_action_without_benchmark'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in ms'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in ms' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/rescue.rb:160:in perform_action_without_flash' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/flash.rb:151:in perform_action'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:532:in send' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:532:in process_without_filters'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/filters.rb:606:in process' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:391:in process'
/usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/base.rb:386:in call' /usr/local/rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.18/lib/action_controller/routing/route_set.rb:438:in call'
Request

Parameters:

{"post"=>{"rating"=>"Explicit",
"parent_id"=>"",
"tags"=>"Not_furry 2009 ackanime alexstrasza blonde_hair blush breasts brown_hair collar cunnilingus elf eyes_closed female hair horn jewelry krasus leash licking navel nipples oral oral_sex pillow pointy_ears pubes pussy sex tongue vaginal video_games warcraft world_of_warcraft",
"source"=>"",
"hide_google"=>false,
"hide_anon"=>false,
"old_tags"=>"2009 ackanime alexstrasza blonde_hair blush breasts brown_hair collar cunnilingus elf eyes_closed female hair horn jewelry krasus leash licking navel nipples oral oral_sex pillow pointy_ears pubes pussy sex tongue vaginal video_games warcraft world_of_warcraft",
"description"=>""},
"id"=>"262740",
"reason"=>""}
Show session dump

Response

Headers:

{"Set-Cookie"=>"blacklisted_tags=gore; path=/\nblacklist_avatars=true; path=/\nblacklist_users=false; path=/",
"Cache-Control"=>"no-cache",
"Content-Type"=>""}

Updated by EDFDarkAngel1

Not sure what causes it, but it sometimes happens and trying again usually works

Updated by anonymous

A dead lock basically happens when 2 processes try to change the same table at once(it's a bit more complex, but that's the easy way to put it).
They end up waiting for each other, unless an automatic process kills one, and that's when you get this kind of error.

Disclaimer: This is based on my knowledge of Oracle databases, not sure what kind of database is being used here, but it's not oracle, so the terminology/software may be different enough that I'm completely wrong.

Updated by anonymous

ETAIL: Process 30164 waits for ShareLock on transaction 820013141; blocked by process 30167.
Process 30167 waits for ShareLock on transaction 820013140; blocked by process 30164.

I'd say that's pretty much spot on, two processes wait for each other to finish, the server kills one or both.

Updated by anonymous

NotMeNotYou said:
ETAIL: Process 30164 waits for ShareLock on transaction 820013141; blocked by process 30167.
Process 30167 waits for ShareLock on transaction 820013140; blocked by process 30164.

I'd say that's pretty much spot on, two processes wait for each other to finish, the server kills one or both.

Hey guys, we are aware of this and are working on it. Sorry about that!

Updated by anonymous

  • 1