Page MenuHomePhabricator

Wikibase\SiteLinkTable::saveLinksOfItem deadlocks
Closed, ResolvedPublic

Description

A fair amount of these in the logs.

dberror.log:
Thu Apr 25 16:28:04 UTC 2013 mw1135 wikidatawiki Wikibase\SiteLinkTable::saveLinksOfItem 10.64.32.28 1213 Deadlock found when trying to get lock; try restarting transaction (10.64.32.28) INSERT INTO wb_items_per_site (ips_item_id,ips_site_id,ips_site_page) VALUES ('11909280','cawiki','Bhinai')

exception.log:
2013-04-25 07:30:08 mw1129 wikidatawiki: #0 /usr/local/apache/common-local/php-1.22wmf2/includes/db/Database.php(988): DatabaseBase->reportQueryError('Deadlock found ...', 1213, 'INSERT INTO `w...', 'Wikibase\SiteLi...', false)
#1 /usr/local/apache/common-local/php-1.22wmf2/includes/db/Database.php(1792): DatabaseBase->query('INSERT INTO `w...', 'Wikibase\SiteLi...')
#2 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/lib/includes/store/sql/SiteLinkTable.php(124): DatabaseBase->insert('wb_items_per_si...', Array, 'Wikibase\SiteLi...')
#3 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/updates/ItemModificationUpdate.php(54): Wikibase\SiteLinkTable->saveLinksOfItem(Object(Wikibase\Item))
#4 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/updates/EntityModificationUpdate.php(77): Wikibase\ItemModificationUpdate->doTypeSpecificStuff(Object(Wikibase\SqlStore), Object(Wikibase\Item))
#5 /usr/local/apache/common-local/php-1.22wmf2/includes/DataUpdate.php(100): Wikibase\EntityModificationUpdate->doUpdate()
#6 /usr/local/apache/common-local/php-1.22wmf2/includes/WikiPage.php(2068): DataUpdate::runUpdates(Array)
#7 /usr/local/apache/common-local/php-1.22wmf2/includes/WikiPage.php(1905): WikiPage->doEditUpdates(Object(Revision), Object(User), Array)
#8 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/content/EntityContent.php(492): WikiPage->doEditContent(Object(Wikibase\ItemContent), '/* wbeditentity...', 81, 0, Object(User))
#9 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/EditEntity.php(709): Wikibase\EntityContent->save('/* wbeditentity...', Object(User), 81, 0, NULL)
#10 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/api/ApiWikibase.php(688): Wikibase\EditEntity->attemptSave('/* wbeditentity...', 17, 'b27e43ee2b49a2a...')
#11 /usr/local/apache/common-local/php-1.22wmf2/extensions/Wikibase/repo/includes/api/ModifyEntity.php(214): Wikibase\Api\ApiWikibase->attemptSaveEntity(Object(Wikibase\ItemContent), '/* wbeditentity...', 17)
#12 /usr/local/apache/common-local/php-1.22wmf2/includes/api/ApiMain.php(840): Wikibase\Api\ModifyEntity->execute()
#13 /usr/local/apache/common-local/php-1.22wmf2/includes/api/ApiMain.php(380): ApiMain->executeAction()
#14 /usr/local/apache/common-local/php-1.22wmf2/includes/api/ApiMain.php(351): ApiMain->executeActionWithErrorHandling()
#15 /usr/local/apache/common-local/php-1.22wmf2/api.php(77): ApiMain->execute()
#16 /usr/local/apache/common-local/w/api.php(3): require('/usr/local/apac...')
#17 {main}


Version: unspecified
Severity: normal
Whiteboard: u=dev c=backend p=0

Details

Reference
bz47663

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:38 AM
bzimport set Reference to bz47663.
bzimport added a subscriber: Unknown Object (MLST).

Seems like a typical DELETE+INSERT deadlock. It probably could be changed to be incremental or to not issue the DELETE if there are no rows (if that case is common).

aaron@fluorine:~/mw-log$ grep -P '[^ \t]+::[^ \t]+' -o dberror.log | sort | uniq -c

   1 AbuseFilter::addLogEntries
   5 Banner::getHistoricalBanner
   3 Banner::getMixins
   1 Block::insert
   1 DataModelBackendLBFactory::insert
   2 GlobalUsage::insertLinks
   1 LinksDeletionUpdate::doUpdate
  16 MessageGroupStats::clear
   2 MessageGroupStats::forItemInternal
   3 RecentChange::save
   3 SiteStatsUpdate::doUpdate:
   2 User::saveOptions
   1 User::saveSettings
   4 WebVideoTranscodeJob::run
1004 Wikibase\SiteLinkTable::saveLinksOfItem
   3 WikiPage::doDeleteArticleReal),

Hasn't happened much in the last month (nor the month before that):

aaron@fluorine:~/mw-log$ zgrep --no-filename -P '(?<=\s)[a-zA-Z\\:]+::[\w:]+(\s+\([^)]+\))?(?=\s)' -o archive/dberror.log-201403* | sort | uniq -c | sort -rn -k 1

12636 ChangeTags::tagUsageStatistics
10452 SpecialWhatLinksHere::showIndirectLinks
 3487 Title::countRevisionsBetween
 1369 IndexPager::buildQueryInfo (LogPager)
 1241 LinkBatch::doQuery (for Skin::preloadExistence)
 1011 DatabaseMessageIndex::get
  832 ResourceLoaderWikiModule::getTitleMtimes
  608 Revision::fetchFromConds
  535 User::saveOptions
  528 LinkCache::addLinkObj
  495 IndexPager::buildQueryInfo (contributions page unfiltered)
  488 RecentChange::save
  404 MessageGroupStats::forItemInternal
  378 ForeignDBFile::loadExtraFromDB
  352 OutputPage::addCategoryLinks
  317 LinkBatch::doQuery (for GadgetHooks::beforePageDisplay)
  192 Revision::insertOn
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).