Page MenuHomePhabricator

DBQueryError: Deadlock found…, Function: MovePage::moveToInternalQuery (from global rename)
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1213: Deadlock found when trying to get lock; try restarting transaction
Function: MediaWiki\Page\MovePage::moveToInternal
Query: UPDATE  `page` SET page_namespace ...
FrameLocationCall
from/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/Database.php(1232)
#0/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/Database.php(1216)Wikimedia\Rdbms\Database->getQueryException(string, int, string, string)
#1/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/Database.php(1190)Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, int, string, string)
#2/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/Database.php(647)Wikimedia\Rdbms\Database->reportQueryError(string, int, string, string, bool)
#3/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/Database.php(1518)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/DBConnRef.php(127)Wikimedia\Rdbms\Database->update(string, array, array, string, array)
#5/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/database/DBConnRef.php(413)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6/srv/mediawiki/php-1.45.0-wmf.3/includes/libs/rdbms/querybuilder/UpdateQueryBuilder.php(332)Wikimedia\Rdbms\DBConnRef->update(string, array, array, string, array)
#7/srv/mediawiki/php-1.45.0-wmf.3/includes/page/MovePage.php(916)Wikimedia\Rdbms\UpdateQueryBuilder->execute()
#8/srv/mediawiki/php-1.45.0-wmf.3/includes/page/MovePage.php(648)MediaWiki\Page\MovePage->moveToInternal(MediaWiki\User\User, MediaWiki\Title\Title, string, bool, array)
#9/srv/mediawiki/php-1.45.0-wmf.3/includes/page/MovePage.php(461)MediaWiki\Page\MovePage->moveUnsafe(MediaWiki\User\User, string, bool, array)
#10/srv/mediawiki/php-1.45.0-wmf.3/extensions/CentralAuth/includes/GlobalRename/LocalRenameJob/LocalPageMoveJob.php(111)MediaWiki\Page\MovePage->move(MediaWiki\User\User, string, bool)
#11/srv/mediawiki/php-1.45.0-wmf.3/extensions/CentralAuth/includes/GlobalRename/LocalRenameJob/LocalPageMoveJob.php(84)MediaWiki\Extension\CentralAuth\GlobalRename\LocalRenameJob\LocalPageMoveJob->movePage(MediaWiki\Title\Title, MediaWiki\Title\Title)
#12/srv/mediawiki/php-1.45.0-wmf.3/extensions/EventBus/includes/JobExecutor.php(88)MediaWiki\Extension\CentralAuth\GlobalRename\LocalRenameJob\LocalPageMoveJob->run()
#13/srv/mediawiki/rpc/RunSingleJob.php(60)MediaWiki\Extension\EventBus\JobExecutor->execute(array)
#14{main}
Impact

Probably causes some user pages of renamed users not to be moved to their new usernames.

Notes

Seeing quite a bit in the last 30 days

Details

Request URL
https://mw-jobrunner.discovery.wmnet/rpc/RunSingleJob.php

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Untagging JobQueue as the deadlock will be due to different pieces of MediaWiki code running around the same time, causing to lock each other out. Unless we think the JobQueue is running jobs that we didn't ask it to run, that rules out JobQueue as cause. Likewise for the Rdbms component, it is doing exactly what it is asked, deadlocks generally do not happen due to bugs inside Rdbms, but due to core/extension code genuinely causing those locks due to queries that require the same locks.

The leaves either CentralAuth (relating to how we run the CentralAuth LocalRenameJob) or MediaWiki core (relating to MovePage). It may be that this code is running its steps in an inconsitent order and so ends up locking itself. It may also be locking with other code, for example, between MovePage and between EditPage. That is, someone may be editing the user's talk page while the job tries to rename it.

We had six stuck global renames since last Thursday (thanks @Ammarpad for handling most of them!). Before that, we usually had 1-2 per week. That's probably caused by this.

HCoplin-WMF subscribed.

Removing MWI -- we were added from herald rules related to JobQueue.

matmarex renamed this task from DBQueryError: Error 1213: Deadlock found when trying to get lock; try restarting transactionFunction: MovePage::moveToInternalQuery to DBQueryError: Deadlock found…, Function: MovePage::moveToInternalQuery.Jul 29 2025, 11:13 PM
matmarex updated the task description. (Show Details)
matmarex subscribed.

See also T400772 for another deadlock in the user rename code. No idea if they're related.

matmarex renamed this task from DBQueryError: Deadlock found…, Function: MovePage::moveToInternalQuery to DBQueryError: Deadlock found…, Function: MovePage::moveToInternalQuery (from global rename).Jul 29 2025, 11:16 PM