Page MenuHomePhabricator

Lock wait timeout exceeded (WikiPage::insertRedirectEntry) when renaming pages or otherwise editing/creating redirects
Closed, ResolvedPublic

Description

Error

Error when creating a redirect, from T220353#5092493, by @Daimona
message
A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: INSERT INTO `redirect` (rd_from,rd_namespace,rd_title,rd_fragment,rd_interwiki) VALUES ([REDACTED],'0',[REDACTED],[REDACTED],[REDACTED]) ON DUPLICATE KEY UPDATE rd_namespace = '0',rd_title = [REDACTED],rd_fragment = '',rd_interwiki = ''
Function: WikiPage::insertRedirectEntry
Error: 1205 Lock wait timeout exceeded; try restarting transaction
trace
#0 /srv/mediawiki/php-1.33.0-wmf.23/includes/libs/rdbms/database/Database.php(1530): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /srv/mediawiki/php-1.33.0-wmf.23/includes/libs/rdbms/database/Database.php(1248): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /srv/mediawiki/php-1.33.0-wmf.23/includes/libs/rdbms/database/DatabaseMysqlBase.php(1347): Wikimedia\Rdbms\Database->query(string, string)
#3 /srv/mediawiki/php-1.33.0-wmf.23/includes/page/WikiPage.php(1091): Wikimedia\Rdbms\DatabaseMysqlBase->upsert(string, array, array, array, string)
#4 /srv/mediawiki/php-1.33.0-wmf.23/includes/page/WikiPage.php(1464): WikiPage->insertRedirectEntry(Title)
#5 /srv/mediawiki/php-1.33.0-wmf.23/includes/page/WikiPage.php(1423): WikiPage->updateRedirectOn(Wikimedia\Rdbms\DBConnRef, Title, NULL)
#6 /srv/mediawiki/php-1.33.0-wmf.23/includes/Storage/PageUpdater.php(1125): WikiPage->updateRevisionOn(Wikimedia\Rdbms\DBConnRef, Revision, integer)
#7 /srv/mediawiki/php-1.33.0-wmf.23/includes/Storage/PageUpdater.php(758): MediaWiki\Storage\PageUpdater->doCreate(CommentStoreComment, User, integer)
#8 /srv/mediawiki/php-1.33.0-wmf.23/includes/page/WikiPage.php(1916): MediaWiki\Storage\PageUpdater->saveRevision(CommentStoreComment, integer)
#9 /srv/mediawiki/php-1.33.0-wmf.23/includes/EditPage.php(2304): WikiPage->doEditContent(WikitextContent, CommentStoreComment, integer, boolean, User, string, array, integer)
#10 /srv/mediawiki/php-1.33.0-wmf.23/includes/EditPage.php(1595): EditPage->internalAttemptSave(array, boolean)
#11 /srv/mediawiki/php-1.33.0-wmf.23/includes/EditPage.php(694): EditPage->attemptSave(array)
#12 /srv/mediawiki/php-1.33.0-wmf.23/includes/actions/EditAction.php(60): EditPage->edit()
#13 /srv/mediawiki/php-1.33.0-wmf.23/includes/actions/SubmitAction.php(38): EditAction->show()
#14 /srv/mediawiki/php-1.33.0-wmf.23/includes/MediaWiki.php(501): SubmitAction->show()
#15 /srv/mediawiki/php-1.33.0-wmf.23/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#16 /srv/mediawiki/php-1.33.0-wmf.23/includes/MediaWiki.php(867): MediaWiki->performRequest()
#17 /srv/mediawiki/php-1.33.0-wmf.23/includes/MediaWiki.php(517): MediaWiki->main()
#18 /srv/mediawiki/php-1.33.0-wmf.23/index.php(42): MediaWiki->run()
#19 /srv/mediawiki/w/index.php(3): include(string)
#20 {main}
Impact

This can cause the following user scenarios to fail:

Original task description by @Banjo

Template page https://gl.wikipedia.org/wiki/Modelo:ZWEb was overwritten with another redirect template that was pointing to it. We cannot undo the self-redirect now, any edit/move/delete attempt results in below error:

A database query error has occurred. This may indicate a bug in the software.

Function: WikiPage::insertRedirectEntry
Error: 1205 Lock wait timeout exceeded; try restarting transaction (10.64.16.27)

Page history: https://gl.wikipedia.org/w/index.php?title=Modelo:ZWEb&action=history

Event Timeline

Banjo raised the priority of this task from to Needs Triage.
Banjo updated the task description. (Show Details)
Banjo added a project: MediaWiki-Templates.
Banjo subscribed.
Jdforrester-WMF subscribed.

This is… surprising, and not good.

fixed it, I had to do the following:

Merge history of https://gl.wikipedia.org/wiki/Modelo:ZWEb to https://gl.wikipedia.org/wiki/Modelo:ZIMb
Edit https://gl.wikipedia.org/wiki/Modelo:ZIMb removing the redirect text
Moving https://gl.wikipedia.org/wiki/Modelo:ZIMb to https://gl.wikipedia.org/wiki/Modelo:ZWEb

No actions needed on our side, this should sort it out. Let me know if you need further details for any tests or further investigation you want to perform.

Jackmcbarn renamed this task from Template page with self redirect cannot be edited to Lock wait timeout exceeded when editing a self-redirecting template.Dec 4 2015, 3:14 AM
aaron added subscribers: aaron, Bawolff, Hanay and 2 others.
Krinkle renamed this task from Lock wait timeout exceeded when editing a self-redirecting template to Lock wait timeout exceeded (WikiPage::insertRedirectEntry) when editing a self-redirecting template.Aug 4 2018, 4:52 PM

Still seen on 1.32.0-wmf.24.

Query: INSERT INTO `redirect` (rd_from,rd_namespace,rd_title,rd_fragment,rd_interwiki) VALUES ('#######','3','###','','') ON DUPLICATE KEY UPDATE rd_namespace = '3',rd_title = '###',rd_fragment = '',rd_interwiki = ''
Function: WikiPage::insertRedirectEntry
Error: 1205 Lock wait timeout exceeded; try restarting transaction


Exception executing job: LocalPageMoveJob LocalRenameUserJob from=#### new=[3,"###"] old=[3,"####"] renamer=##### requestId=W7ZqqgrAADQAAGD8BUoAAAAN session={"headers":"array(...)","ip":"########","sessionId":"","userId":0} suppressredirects= to=### : 

Wikimedia\Rdbms\DBQueryError: A database query error has occurred.
trace
#2 /srv/mediawiki/php-1.32.0-wmf.24/includes/libs/rdbms/database/DatabaseMysqlBase.php(1367): Wikimedia\Rdbms\Database->query(string, string)
#3 /srv/mediawiki/php-1.32.0-wmf.24/includes/page/WikiPage.php(1057): Wikimedia\Rdbms\DatabaseMysqlBase->upsert(string, array, array, array, string)
#4 /srv/mediawiki/php-1.32.0-wmf.24/includes/page/WikiPage.php(1430): WikiPage->insertRedirectEntry(Title)
#5 /srv/mediawiki/php-1.32.0-wmf.24/includes/page/WikiPage.php(1389): WikiPage->updateRedirectOn(Wikimedia\Rdbms\DatabaseMysqli, Title, NULL)
#6 /srv/mediawiki/php-1.32.0-wmf.24/includes/MovePage.php(589): WikiPage->updateRevisionOn(Wikimedia\Rdbms\DatabaseMysqli, Revision, integer)
#7 /srv/mediawiki/php-1.32.0-wmf.24/includes/MovePage.php(271): MovePage->moveToInternal(User, Title, string, boolean, array)
#8 /srv/mediawiki/php-1.32.0-wmf.24/extensions/CentralAuth/includes/LocalRenameJob/LocalPageMoveJob.php(73): MovePage->move(User, string, boolean)
#9 /srv/mediawiki/php-1.32.0-wmf.24/extensions/CentralAuth/includes/LocalRenameJob/LocalPageMoveJob.php(55): LocalPageMoveJob->movePage(Title, Title)
#10 /srv/mediawiki/php-1.32.0-wmf.24/extensions/EventBus/includes/JobExecutor.php(65): LocalPageMoveJob->run()

Are these jobs that try to also move user subpages?

Are these jobs that try to also move user subpages?

Yes, from what I can tell, the only code that queues a LocalPageMoveJob is another job, namely LocalRenameUserJob. However, they are not nested as far as I can tell. Rather, LocalRenameUserJob pushes instances of LocalPageMoveJob into the queue.

From what I can tell, each LocalPageMoveJob only performs a single page rename. And LocalRenameUserJob itself doesn't perform any edits or page writes (only user and globaluser table interaction).

Krinkle renamed this task from Lock wait timeout exceeded (WikiPage::insertRedirectEntry) when editing a self-redirecting template to Lock wait timeout exceeded (WikiPage::insertRedirectEntry) when renaming pages or otherwise editing/creating redirects.Oct 20 2021, 8:15 PM
Krinkle edited projects, added MediaWiki-Page-rename; removed MediaWiki-Templates.

Change 742217 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] Reduce delete attempts on redirect table for move and page creation

https://gerrit.wikimedia.org/r/742217

Still seen.

As with T220353 and T220353, appears to be disproportionally affecting de.wikipedia.org.

  • [f79e1c3f-e42c-4efb-a028-8af65a37a7a7] /w/index.php?title=Spezial:Verschieben&action=submit Wikimedia\Rdbms\DBQueryError: Lock wait timeout exceeded; Function: WikiPage::insertRedirectEntry
  • [32766ec4-8991-41d7-989b-ed98d67bc473] /w/index.php?title=Spezial:Verschieben&action=submit Wikimedia\Rdbms\DBQueryError: Lock wait timeout exceeded; Function: WikiPage::insertRedirectEntry

Change 742217 merged by jenkins-bot:

[mediawiki/core@master] Reduce delete attempts on redirect table for move and page creation

https://gerrit.wikimedia.org/r/742217

Umherirrender claimed this task.

Still seen.

As with T220353 and T220353, appears to be disproportionally affecting de.wikipedia.org.

  • [f79e1c3f-e42c-4efb-a028-8af65a37a7a7] /w/index.php?title=Spezial:Verschieben&action=submit Wikimedia\Rdbms\DBQueryError: Lock wait timeout exceeded; Function: WikiPage::insertRedirectEntry
  • [32766ec4-8991-41d7-989b-ed98d67bc473] /w/index.php?title=Spezial:Verschieben&action=submit Wikimedia\Rdbms\DBQueryError: Lock wait timeout exceeded; Function: WikiPage::insertRedirectEntry

Hopefully since the deployment of wmf.7 this should no longer be an issue (but other issues with page moves still exists)