Last modified: 2012-09-05 17:41:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30485, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28485 - Block::purgeExpired giving "Lock wait timeout exceeded;"/"Deadlock"
Block::purgeExpired giving "Lock wait timeout exceeded;"/"Deadlock"
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
User blocking (Other open bugs)
1.17.x
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-reviewed
Depends on:
Blocks: 28499 28599
  Show dependency treegraph
 
Reported: 2011-04-10 23:34 UTC by Sam Reed (reedy)
Modified: 2012-09-05 17:41 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch... (532 bytes, patch)
2011-04-10 23:52 UTC, Sam Reed (reedy)
Details

Description Sam Reed (reedy) 2011-04-10 23:34:33 UTC
"Block::purgeExpired". Database returned error "1205: Lock wait timeout exceeded; try restarting transaction"

Getting more common

Needs dealing with.

<domas> reedy: open another connection with a separate transaction for the actual purge DELETE statement
<domas> reedy: you have to create new LoadBalancer object for that I hear
<domas> Tim once showed me how, was something really simple
<domas> but this is a good thing to do both for ipblocks purges and recentchanges ones
Comment 1 Sam Reed (reedy) 2011-04-10 23:52:39 UTC
Created attachment 8390 [details]
Patch...
Comment 2 Sam Reed (reedy) 2011-04-10 23:53:38 UTC
Tim, is this simply what is needed to fix this issue?
Comment 3 Tim Starling 2011-04-11 00:24:46 UTC
No, wfGetLB() does not create a new load balancer, it gets a cached one. You want:

$lb = wfGetLBFactory()->newMainLB();
$db = $lb->getConnection( DB_MASTER );
...
$lb->commitMasterChanges();
$lb->closeAll();
Comment 4 Sam Reed (reedy) 2011-04-11 00:29:52 UTC
r85776
Comment 5 Sam Reed (reedy) 2011-04-11 00:30:00 UTC
Comment on attachment 8390 [details]
Patch...

>Index: Block.php
>===================================================================
>--- Block.php	(revision 85768)
>+++ Block.php	(working copy)
>@@ -889,7 +889,9 @@
> 	 * Purge expired blocks from the ipblocks table
> 	 */
> 	public static function purgeExpired() {
>-		$dbw = wfGetDB( DB_MASTER );
>+		global $wgDbBname;
>+		$lb = wfGetLb( $wgDbBname );
>+		$dbw = $lb->getConnection( DB_MASTER, array(), $wgDbBname );
> 		$dbw->delete( 'ipblocks', array( 'ipb_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), __METHOD__ );
> 	}
>
Comment 6 Sam Reed (reedy) 2011-04-12 20:28:37 UTC
Reverted in r85916, pending a better solution
Comment 7 Sam Reed (reedy) 2011-04-18 20:05:44 UTC
Mon Apr 18 20:01:46 UTC 2011    srv279  enwiki  Block::purgeExpired     10.0.6.46       1213    Deadlock found when trying to get lock; try restarting transaction (10.0.6.46)  DELETE FROM `ipblocks` WHERE (ipb_expiry < '20110418200055')


Expanding and assigning bug
Comment 8 Rob Lanphier 2011-08-05 00:02:23 UTC
Sam, is this still an issue, and is it still getting more frequent?  If so, we can figure out which one of us will deal with this sometime after Wikimania.
Comment 9 Sam Reed (reedy) 2011-08-05 12:39:54 UTC
For all of July, and august so far, picking up all the errors > 500 we have the below

So This is still the most common DB error on wikimedia wikis


Totals:
Deadlock total count:8278
Lock wait timeout total count:4979
Dupe entry total count:1656

Block::purgeExpired 4147
Job::pop_type 3940
Article::updateCategoryCounts 1490
User::invalidateCache 1091
SimpleSurvey::save 770
Title::invalidateCache 759
Job::pop 757
GlobalUsage::insertLinks 700
Comment 10 Mark A. Hershberger 2011-10-19 15:32:58 UTC
Could you update the stats for September so we can see relative frequency?
Comment 11 matanya 2012-08-15 10:23:31 UTC
Is this still an issue?
Comment 12 matanya 2012-09-05 17:34:41 UTC
<binasher> yeah, just looked at the last month of db error logs, no issues from Block::purgeExpired
Comment 13 Sumana Harihareswara 2012-09-05 17:35:11 UTC
<binasher> Block::purgeExpired is not hitting lock timeouts.
<sumanah> binasher: so we can close as no repro, correct?
<binasher> yeah, just looked at the last month of db error logs, no issues from Block::purgeExpired

So this isn't happening anymore and I'm closing this bug.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links