Page MenuHomePhabricator

Edit summaries containing a link and interwiki link with the same name causes inaccurate redlinks
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Save an edit with a summary that contains a local link and interwiki link with the same page name.

What happens?:
One of these links (I think always the local one) will show as a redlink regardless of whether it exists.

What should have happened instead?:
The links should have accurately displayed their redlink status.

See e.g. https://en.wikipedia.org/w/index.php?diff=609006048

Reported at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Special:Diff/609006048

Event Timeline

Change 757781 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Fix pollution of LinkBatch/LinkCache with interwiki link

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

One piece of the puzzle that I didn't mention in the commit message: the bug only happens for pages not in the main namespace, because LinkBatch is creating a TitleValue with ns=0 and dbkey=Template:Foo and then adding that to the LinkCache. LinkCache::getCacheKey() returns "Template:Foo" for that title, which collides with the key for ns=10 dbkey=Foo. Possibly LinkCache should be using cache keys with integer namespaces, then TitleFormatter would not need to be called in that code path, and it would be a bit faster.

Change 757781 merged by jenkins-bot:

[mediawiki/core@master] Fix pollution of LinkBatch/LinkCache with interwiki link

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

Krinkle triaged this task as High priority.Jan 31 2022, 7:30 PM

Possibly LinkCache should be using cache keys with integer namespaces, then TitleFormatter would not need to be called in that code path, and it would be a bit faster.

The actual reason for the TitleFormatter dependency is the fact that the public methods getGoodLinkID(), isBadLink() and clearBadLink() accept strings as parameters, presumed to be PDBKs. The TitleFormatter allows titles passed as objects to be compared with those passed as strings. To remove the TitleFormatter dependency, first we would have to deprecate the passing of strings to these methods.

Hi, The warning added with this task is blocking some page views at Miraheze. Can we get guidance on how to fix.

https://tampvan.miraheze.org/wiki/Benua_Greget & https://tampvan.miraheze.org/w/index.php?title=Perserikatan_Bangsa_Greget are affected at least

Skipping interwiki link
LinkBatch.php line 153 calls wfBacktrace()
LinkBatch.php line 119 calls LinkBatch->addObj()
LinkBatchFactory.php line 99 calls LinkBatch->__construct()
Skin.php line 451 calls MediaWiki\Cache\LinkBatchFactory->newLinkBatch()
Skin.php line 297 calls Skin->preloadExistence()
SkinTemplate.php line 146 calls Skin->initPage()
OutputPage.php line 2807 calls SkinTemplate->outputPage()
MWException.php line 187 calls OutputPage->output()
MWException.php line 221 calls MWException->reportHTML()
MWExceptionHandler.php line 105 calls MWException->report()
MWExceptionHandler.php line 202 calls MWExceptionHandler::report()
MediaWiki.php line 583 calls MWExceptionHandler::handleException()
index.php line 53 calls MediaWiki->run()
index.php line 46 calls wfIndexMain()
This comment was removed by Aklapper.

The pages show "Kekecualian fatal tipe "MWException"". Please give the details of the exception. A log warning is not (or at least should not be) an exception of type MWException.

Also maybe split it out to a separate bug.

@tstarling: that was the only log entry matching the request ID. Happy to move to another bug.

The pages show "Kekecualian fatal tipe "MWException"". Please give the details of the exception. A log warning is not (or at least should not be) an exception of type MWException.

I don't know what the problem is, it's clear that some articles are damaged

@ChioGaming2007: Please let our SRE team handle things. We have already spoken to Tim so we can fix this. We will communicate with you if action is needed and have access to much more than you do on the technical side. Your article is not damaged, it just won't render.

Hi, The warning added with this task is blocking some page views at Miraheze. Can we get guidance on how to fix.

https://tampvan.miraheze.org/wiki/Benua_Greget & https://tampvan.miraheze.org/w/index.php?title=Perserikatan_Bangsa_Greget are affected at least

Skipping interwiki link
LinkBatch.php line 153 calls wfBacktrace()
LinkBatch.php line 119 calls LinkBatch->addObj()
LinkBatchFactory.php line 99 calls LinkBatch->__construct()
Skin.php line 451 calls MediaWiki\Cache\LinkBatchFactory->newLinkBatch()
Skin.php line 297 calls Skin->preloadExistence()
SkinTemplate.php line 146 calls Skin->initPage()
OutputPage.php line 2807 calls SkinTemplate->outputPage()
MWException.php line 187 calls OutputPage->output()
MWException.php line 221 calls MWException->reportHTML()
MWExceptionHandler.php line 105 calls MWException->report()
MWExceptionHandler.php line 202 calls MWExceptionHandler::report()
MediaWiki.php line 583 calls MWExceptionHandler::handleException()
index.php line 53 calls MediaWiki->run()
index.php line 46 calls wfIndexMain()

This is the full actual exception here:

[7361a92e0f43dd1138a5bf26] /wiki/Dunia_Minecraft MWException: Parser state cleared while parsing. Did you call Parser::parse recursively? Lock is held by: #0 /srv/mediawiki/w/includes/parser/Parser.php(673): Parser->lock()
#1 /srv/mediawiki/w/includes/content/WikitextContentHandler.php(294): Parser->parse('{{Halal22}}\n{{M...', Object(Title), Object(ParserOptions), true, true, 14776)
#2 /srv/mediawiki/w/includes/content/ContentHandler.php(1705): WikitextContentHandler->fillParserOutput(Object(WikitextContent), Object(MediaWiki\Content\Renderer\ContentParseParams), Object(ParserOutput))
#3 /srv/mediawiki/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(Object(WikitextContent), Object(MediaWiki\Content\Renderer\ContentParseParams))
#4 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(267): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(Object(WikitextContent), Object(Title), 14776, Object(ParserOptions), true)
#5 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(238): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(Object(WikitextContent), true)
#6 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput('main', Array)
#7 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(Object(MediaWiki\Revision\RenderedRevision), Array)
#8 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(Object(MediaWiki\Revision\RenderedRevision), Array)
#9 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(200): call_user_func(Object(Closure), Object(MediaWiki\Revision\RenderedRevision), Array)
#10 /srv/mediawiki/w/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#11 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#12 /srv/mediawiki/w/includes/page/ParserOutputAccess.php(302): PoolCounterWork->execute()
#13 /srv/mediawiki/w/includes/page/Article.php(702): MediaWiki\Page\ParserOutputAccess->getParserOutput(Object(WikiPage), Object(ParserOptions), Object(MediaWiki\Revision\RevisionStoreCacheRecord), 5)
#14 /srv/mediawiki/w/includes/page/Article.php(517): Article->generateContentOutput(Object(User), Object(ParserOptions), 0, Object(OutputPage), Array)
#15 /srv/mediawiki/w/includes/actions/ViewAction.php(80): Article->view()
#16 /srv/mediawiki/w/includes/MediaWiki.php(544): ViewAction->show()
#17 /srv/mediawiki/w/includes/MediaWiki.php(321): MediaWiki->performAction(Object(Article), Object(Title))
#18 /srv/mediawiki/w/includes/MediaWiki.php(910): MediaWiki->performRequest()
#19 /srv/mediawiki/w/includes/MediaWiki.php(564): MediaWiki->main()
#20 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#21 /srv/mediawiki/w/index.php(46): wfIndexMain()
#22 {main}

Backtrace:

from /srv/mediawiki/w/includes/parser/Parser.php(6354)
#0 /srv/mediawiki/w/includes/parser/Parser.php(673): Parser->lock()
#1 /srv/mediawiki/w/extensions/Scribunto/includes/common/ScribuntoContentHandler.php(146): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#2 /srv/mediawiki/w/includes/content/ContentHandler.php(1705): ScribuntoContentHandler->fillParserOutput(ScribuntoContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#3 /srv/mediawiki/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(ScribuntoContent, MediaWiki\Content\Renderer\ContentParseParams)
#4 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(267): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(ScribuntoContent, Title, integer, ParserOptions, boolean)
#5 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(238): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(ScribuntoContent, boolean)
#6 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#7 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#8 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#9 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(200): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#10 /srv/mediawiki/w/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#11 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#12 /srv/mediawiki/w/includes/page/ParserOutputAccess.php(302): PoolCounterWork->execute()
#13 /srv/mediawiki/w/includes/filerepo/file/LocalFile.php(2556): MediaWiki\Page\ParserOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, ParserOptions)
#14 /srv/mediawiki/w/extensions/CommonsMetadata/src/DataCollector.php(258): LocalFile->getDescriptionText(LanguageEn)
#15 /srv/mediawiki/w/extensions/CommonsMetadata/src/DataCollector.php(96): CommonsMetadata\DataCollector->getDescriptionText(LocalFile, LanguageEn)
#16 /srv/mediawiki/w/extensions/CommonsMetadata/src/HookHandler.php(75): CommonsMetadata\DataCollector->collect(array, LocalFile)
#17 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(338): CommonsMetadata\HookHandler::onGetExtendedMetadata(array, LocalFile, DerivativeContext, boolean, integer)
#18 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#19 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(1811): MediaWiki\HookContainer\HookContainer->run(string, array)
#20 /srv/mediawiki/w/includes/media/FormatMetadata.php(1817): MediaWiki\HookContainer\HookRunner->onGetExtendedMetadata(array, LocalFile, DerivativeContext, boolean, integer)
#21 /srv/mediawiki/w/includes/media/FormatMetadata.php(1738): FormatMetadata->getExtendedMetadataFromHook(LocalFile, array, integer)
#22 /srv/mediawiki/w/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php(396): FormatMetadata->fetchExtendedMetadata(LocalFile)
#23 /srv/mediawiki/w/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php(377): PageImages\Hooks\ParserFileProcessingHookHandlers->fetchFileMetadata(LocalFile)
#24 /srv/mediawiki/w/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php(223): PageImages\Hooks\ParserFileProcessingHookHandlers->isImageFree(string)
#25 /srv/mediawiki/w/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php(169): PageImages\Hooks\ParserFileProcessingHookHandlers->findBestImages(array)
#26 /srv/mediawiki/w/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php(66): PageImages\Hooks\ParserFileProcessingHookHandlers->doParserAfterTidy(Parser, string)
#27 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(338): PageImages\Hooks\ParserFileProcessingHookHandlers::onParserAfterTidy(Parser, string)
#28 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#29 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(2828): MediaWiki\HookContainer\HookContainer->run(string, array)
#30 /srv/mediawiki/w/includes/parser/Parser.php(1721): MediaWiki\HookContainer\HookRunner->onParserAfterTidy(Parser, string)
#31 /srv/mediawiki/w/includes/parser/Parser.php(700): Parser->internalParseHalfParsed(string, boolean, boolean)
#32 /srv/mediawiki/w/includes/content/WikitextContentHandler.php(294): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#33 /srv/mediawiki/w/includes/content/ContentHandler.php(1705): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#34 /srv/mediawiki/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#35 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(267): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, integer, ParserOptions, boolean)
#36 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(238): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#37 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#38 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#39 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#40 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(200): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#41 /srv/mediawiki/w/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#42 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#43 /srv/mediawiki/w/includes/page/ParserOutputAccess.php(302): PoolCounterWork->execute()
#44 /srv/mediawiki/w/includes/page/Article.php(702): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, integer)
#45 /srv/mediawiki/w/includes/page/Article.php(517): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#46 /srv/mediawiki/w/includes/actions/ViewAction.php(80): Article->view()
#47 /srv/mediawiki/w/includes/MediaWiki.php(544): ViewAction->show()
#48 /srv/mediawiki/w/includes/MediaWiki.php(321): MediaWiki->performAction(Article, Title)
#49 /srv/mediawiki/w/includes/MediaWiki.php(910): MediaWiki->performRequest()
#50 /srv/mediawiki/w/includes/MediaWiki.php(564): MediaWiki->main()
#51 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#52 /srv/mediawiki/w/index.php(46): wfIndexMain()
#53 {main}

This seems to be entirely different and should probably be a whole new report here.