Page MenuHomePhabricator

Fatal DB error when moving pages: Duplicate entry for key 'name_title' / Lock contention / Deadlock
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error

Request URL: (Special:MovePage)
Request ID: XNnkVApAICwAAK-hLCQAAAAH

message
Wikimedia\Rdbms\DBQueryError from line 1587 of /srv/mediawiki/php-1.34.0-wmf.4/includes/libs/rdbms/database/Database.php: A database query error has occurred.
…
Query: UPDATE  `page` SET page_namespace = '0',page_title = 'Dymitr_(Bekiaris-Mawrogonatos)' WHERE page_id = '4538506'
Function: MovePage::moveToInternal
Error: 1062 Duplicate entry '0-Dymitr_(Bekiaris-Mawrogonatos)' for key 'name_title' (10.64.0.110)
trace
…
#3 /srv/mediawiki/php-1.34.0-wmf.4/includes/MovePage.php(620): Wikimedia\Rdbms\Database->update(string, array, array, string)
#4 /srv/mediawiki/php-1.34.0-wmf.4/includes/MovePage.php(318): MovePage->moveToInternal(User, Title, string, boolean, array)
#5 /srv/mediawiki/php-1.34.0-wmf.4/includes/MovePage.php(286): MovePage->moveUnsafe(User, string, boolean, array)
#6 /srv/mediawiki/php-1.34.0-wmf.4/includes/specials/SpecialMovepage.php(597): MovePage->moveIfAllowed(User, string, boolean)
#7 /srv/mediawiki/php-1.34.0-wmf.4/includes/specials/SpecialMovepage.php(128): MovePageForm->doSubmit()
#8 /srv/mediawiki/php-1.34.0-wmf.4/includes/specialpage/SpecialPage.php(569): MovePageForm->execute(NULL)
#9 /srv/mediawiki/php-1.34.0-wmf.4/includes/specialpage/SpecialPageFactory.php(575): SpecialPage->run(NULL)
#10 /srv/mediawiki/php-1.34.0-wmf.4/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#11 /srv/mediawiki/php-1.34.0-wmf.4/includes/MediaWiki.php(865): MediaWiki->performRequest()
#12 /srv/mediawiki/php-1.34.0-wmf.4/includes/MediaWiki.php(515): MediaWiki->main()
#13 /srv/mediawiki/php-1.34.0-wmf.4/index.php

Impact

User are trying to move a page or change its title, and some of the time, this action is failing.

They are shown a generic "Internal error" page with no further information about what is wrong or what to do.

Notes

This exact trace was from user web request, and seen at least 6 different times in Logstash (past few weeks). Affects en.wikipedia.org, commons.wikimedia.org, pl.wikipedia.org, and ru.wikipedia.org, and possibly others.

The following two are found from the same code path and significantly more prominent, from job runners and api requests.

Related 1 (Deadlock found) / server: job runners

From CentralAuth/LocalRenameJob.
Seen 111 times in last few weeks.
Affects commonswiki, dewiki, …

trace
Query: UPDATE  `page` SET page_namespace = '2',page_title = '<a user name>/<a user sub page>' WHERE page_id = '<a page id>'
Function: MovePage::moveToInternal
Error: 1213 Deadlock found when trying to get lock; try restarting transaction

#2 /srv/mediawiki/php-1.34.0-wmf.1/includes/libs/rdbms/database/Database.php(2195): Wikimedia\Rdbms\Database->query(string, string)
#3 /srv/mediawiki/php-1.34.0-wmf.1/includes/MovePage.php(565): Wikimedia\Rdbms\Database->update(string, array, array, string)
#4 /srv/mediawiki/php-1.34.0-wmf.1/includes/MovePage.php(263): MovePage->moveToInternal(User, Title, string, boolean, array)
#5 /srv/mediawiki/php-1.34.0-wmf.1/extensions/CentralAuth/includes/LocalRenameJob/LocalPageMoveJob.php(73): MovePage->move(User, string, boolean)
#6 /srv/mediawiki/php-1.34.0-wmf.1/extensions/CentralAuth/includes/LocalRenameJob/LocalPageMoveJob.php(55): LocalPageMoveJob->movePage(Title, Title)
#7 /srv/mediawiki/php-1.34.0-wmf.1/extensions/EventBus/includes/JobExecutor.php
Related 2 (Lock wait timeout exceeded) / server: api requests

From action=move API (ApiMove)
Seen 29 times in last few weeks
Affects commonswiki, dewiki, euwiki, ruwiki, …

trace
#2 /srv/mediawiki/php-1.34.0-wmf.1/includes/libs/rdbms/database/Database.php(2195): Wikimedia\Rdbms\Database->query(string, string)
#3 /srv/mediawiki/php-1.34.0-wmf.1/includes/MovePage.php(564): Wikimedia\Rdbms\Database->update(string, array, array, string)
#4 /srv/mediawiki/php-1.34.0-wmf.1/includes/MovePage.php(263): MovePage->moveToInternal(User, Title, string, boolean, array)
#5 /srv/mediawiki/php-1.34.0-wmf.1/includes/api/ApiMove.php(190): MovePage->move(User, string, boolean, array)
#6 /srv/mediawiki/php-1.34.0-wmf.1/includes/api/ApiMove.php(87): ApiMove->movePage(Title, Title, string, boolean, array)
#7 /srv/mediawiki/php-1.34.0-wmf.1/includes/api/ApiMain.php(1593): ApiMove->execute()
#8 /srv/mediawiki/php-1.34.0-wmf.1/includes/api/ApiMain.php(531): ApiMain->executeAction()
#9 /srv/mediawiki/php-1.34.0-wmf.1/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#10 /srv/mediawiki/php-1.34.0-wmf.1/api.php

Event Timeline

Krinkle renamed this task from DBQueryError: Duplicate entry for key 'name_title' (from MovePage::moveToInternal) to Fatal DB error when moving pages: Duplicate entry for key 'name_title' / Lock contention / Deadlock.Jul 1 2019, 4:44 PM
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Xiplus.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM