Opened 5 years ago

Closed 4 years ago

#2924 closed defect (fixed)

[trac] Avoid deadlock in DB cleanup cronjobs

Reported by: matze Assignee: ferris
Priority: P3 Milestone:
Module: Infrastructure Keywords:
Cc: fhd, fred Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29369504
https://codereview.adblockplus.org/29369517

Description

Subject: Cron <trac@issues1> mysql -utrac -p'O7780D8nFJl2onW' 
trac_orders --execute ' INSERT INTO session_attribute (sid, 
authenticated, name, value) SELECT sid, authenticated, name, value FROM 
trac.session_attribute WHERE authenticated = 1 AND name IN ("email", 
"password") ON DUPLICATE KEY UPDATE value=VALUES(value) ' >/dev/null
Date: Tue, 18 Aug 2015 02:00:01 +0000 (UTC)
From: Cron Daemon <***@adblockplus.org>
To: ***@adblockplus.org

ERROR 1213 (40001) at line 1: Deadlock found when trying to get lock; try restarting transaction

Change History (7)

comment:1 Changed 4 years ago by ferris

  • Owner set to ferris
  • Review URL(s) modified (diff)

comment:2 Changed 4 years ago by ferris

We've landed the related commit: https://hg.adblockplus.org/infrastructure/rev/cd9c254fe4c7

Rolling it out on issues1 now and we'll see over time if the cron job runs more stable.

comment:3 Changed 4 years ago by ferris

  • Summary changed from Avoid deadlock in Trac cleanup queries to [trac] Avoid deadlock in DB cleanup cronjobs

comment:4 Changed 4 years ago by ferris

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

It seems that the other cron-job collides as well. Just added a second patch: https://codereview.adblockplus.org/29369517

I've manually applied the change in the issues1 cronjobs for now to see how they run over the holidays. Obviously, it's not critical if these cronjobs fail now and then.

Last edited 4 years ago by ferris (previous) (diff)

comment:5 Changed 4 years ago by ferris

Looking good, no more complaints from this cronjob the last days. I suggest we close this ticket as soon as we've got the second review done, and the changes properly synced to issues1.

comment:6 Changed 4 years ago by abpbot

A commit referencing this issue has landed:
Issue 2924 - Move session cleanup to not collide with sync

comment:7 Changed 4 years ago by ferris

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.