Error
Request ID: W7bPwArAIFkAACfFSSoAAAAF
A database query error has occurred. Query: UPDATE `category` SET cat_pages = cat_pages - 1,cat_files = cat_files - 1 WHERE cat_title = '###' Function: WikiPage::updateCategoryCounts Error: 1213 Deadlock found when trying to get lock; try restarting transaction
#1 /srv/mediawiki/php-1.32.0-wmf.24/includes/libs/rdbms/database/Database.php(1224): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean) #2 /srv/mediawiki/php-1.32.0-wmf.24/includes/libs/rdbms/database/Database.php(2100): Wikimedia\Rdbms\Database->query(string, string) #3 /srv/mediawiki/php-1.32.0-wmf.24/includes/page/WikiPage.php(3483): Wikimedia\Rdbms\Database->update(string, array, array, string) #4 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/LinksUpdate.php(399): WikiPage->updateCategoryCounts(array, array, integer) #5 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/LinksUpdate.php(294): LinksUpdate->updateCategoryCounts(array, array) #6 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/LinksUpdate.php(175): LinksUpdate->doIncrementalUpdate() #7 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/DeferredUpdates.php(268): LinksUpdate->doUpdate() #8 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/DeferredUpdates.php(214): DeferredUpdates::runUpdate(LinksUpdate, Wikimedia\Rdbms\LBFactoryMulti, string, integer) #9 /srv/mediawiki/php-1.32.0-wmf.24/includes/deferred/DeferredUpdates.php(134): DeferredUpdates::execute(array, string, integer) #10 /srv/mediawiki/php-1.32.0-wmf.24/includes/MediaWiki.php(914): DeferredUpdates::doUpdates(string) #11 /srv/mediawiki/php-1.32.0-wmf.24/includes/MediaWiki.php(734): MediaWiki->restInPeace(string, boolean) #12 [internal function]: Closure$MediaWiki::doPostOutputShutdown()
Impact
Exception thrown during a deferred update, which then gets skipped and have no retry. This may lead to database inconsistencies due to the update not having been done. E.g. category queries returning incorrect or outdated results.
Notes
Reported in Logstash 71 times in the last 30 days, of which most were during requests that save an edit. In 14 cases it was from a RefreshLinks job on jobrunners instead.
In addition to the entry in the exception log, there are also 2x the number of errors in the DBQuery logs. The error gets logged exactly twice, every time (142 times). Not sure why that is.
See also: