Page MenuHomePhabricator

Attempt to delete a tag causes fatal error
Closed, ResolvedPublic

Description

[XQAHZgpAAD4AABBSokEAAADF] /wiki/Special:Tags/delete MediaWiki\Storage\NameTableAccessException from line 42 of /srv/mediawiki/php-1.34.0-wmf.8/includes/Storage/NameTableAccessException.php: Failed to access name from change_tag_def using name = testing tag

Backtrace:

#0 /srv/mediawiki/php-1.34.0-wmf.8/includes/Storage/NameTableStore.php(240): MediaWiki\Storage\NameTableAccessException::newFromDetails(string, string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.8/includes/changetags/ChangeTags.php(1236): MediaWiki\Storage\NameTableStore->getId(string)
#2 /srv/mediawiki/php-1.34.0-wmf.8/includes/changetags/ChangeTags.php(1332): ChangeTags::deleteTagEverywhere(string)
#3 /srv/mediawiki/php-1.34.0-wmf.8/includes/specials/SpecialTags.php(442): ChangeTags::deleteTagWithChecks(string, string, User, boolean)
#4 /srv/mediawiki/php-1.34.0-wmf.8/includes/htmlform/HTMLForm.php(675): SpecialTags->processTagForm(array, OOUIHTMLForm)
#5 /srv/mediawiki/php-1.34.0-wmf.8/includes/htmlform/HTMLForm.php(567): HTMLForm->trySubmit()
#6 /srv/mediawiki/php-1.34.0-wmf.8/includes/htmlform/HTMLForm.php(582): HTMLForm->tryAuthorizedSubmit()
#7 /srv/mediawiki/php-1.34.0-wmf.8/includes/specials/SpecialTags.php(383): HTMLForm->show()
#8 /srv/mediawiki/php-1.34.0-wmf.8/includes/specials/SpecialTags.php(57): SpecialTags->showDeleteTagForm(string)
#9 /srv/mediawiki/php-1.34.0-wmf.8/includes/specialpage/SpecialPage.php(570): SpecialTags->execute(string)
#10 /srv/mediawiki/php-1.34.0-wmf.8/includes/specialpage/SpecialPageFactory.php(575): SpecialPage->run(string)
#11 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(865): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.34.0-wmf.8/includes/MediaWiki.php(515): MediaWiki->main()
#14 /srv/mediawiki/php-1.34.0-wmf.8/index.php(42): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(3): include(string)
#16 {main}

Tested with 1.34.0-wmf.8.

Event Timeline

Urbanecm created this task.Jun 11 2019, 8:02 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 11 2019, 8:02 PM

Found the root cause. It's the undefineTag() method, which contains the follow statement, which deletes the tag from change_tag_def, if it's not used anywhere.

undefineTag(); ChangeTags.php
$dbw->delete(
			'change_tag_def',
			[ 'ctd_name' => $tag, 'ctd_count' => 0 ],
			__METHOD__
		);

deleteTagEverywhere() then tries to find the tag's ID, which is not going to succeed, since it was already deleted with undefineTag().

Regarding solution, the simpliest would be probably just to fetch ID before calling undefineTag(). Going to upload a patch for that.

Change 517267 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/core@master] [bugfix] Fetch tag ID before calling undefineTag()

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

Change 517267 merged by jenkins-bot:
[mediawiki/core@master] [bugfix] Fetch tag ID before calling undefineTag()

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

Change 517416 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/core@REL1_33] [bugfix] Fetch tag ID before calling undefineTag()

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

Krinkle closed this task as Resolved.Jun 24 2019, 11:06 PM
Krinkle assigned this task to Urbanecm.
Krinkle removed a project: Patch-For-Review.
Restricted Application added a project: User-Urbanecm. · View Herald TranscriptJun 24 2019, 11:06 PM

Change 517416 merged by jenkins-bot:
[mediawiki/core@REL1_33] [bugfix] Fetch tag ID before calling undefineTag()

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

Change 519146 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/core@REL1_32] [bugfix] Fetch tag ID before calling undefineTag()

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

Change 519146 abandoned by Urbanecm:
[bugfix] Fetch tag ID before calling undefineTag()

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

mmodell changed the subtype of this task from "Task" to "Production Error".Wed, Aug 28, 11:06 PM