Page MenuHomePhabricator

Internal error in Recent Changes for Lexeme namespace due to double-redirect
Closed, ResolvedPublic

Description

How to reproduce:

  • Go to https://www.wikidata.org/wiki/Special:RecentChanges
  • Click on 'Namespaces', select 'Lexeme'
  • No changes are shown – No changes during the given period match these criteria, even though there should be changes
  • Refresh the page. Internal error is shown.

Or go directly to https://www.wikidata.org/wiki/Special:RecentChanges?hidebots=1&hidecategorization=1&namespace=146&limit=500&days=30&enhanced=1&urlversion=2

Details

Related Gerrit Patches:
mediawiki/extensions/WikibaseLexeme : masterAvoid fataling on double-redirects when formatting Lexeme links.

Event Timeline

Lydia_Pintscher triaged this task as High priority.Jul 25 2019, 2:22 PM
Lydia_Pintscher changed the subtype of this task from "Task" to "Bug Report".
Lydia_Pintscher moved this task from Incoming to Ready to estimate on the Wikidata-Campsite board.
Ladsgroup added a subscriber: Ladsgroup.EditedJul 25 2019, 3:07 PM

Logstash output:

Unresolved redirect from L44168 to L44166
/srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php:143

#0 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/DispatchingEntityRevisionLookup.php(59): Wikibase\Lib\Store\Sql\WikiPageEntityRevisionLookup->getEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#1 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityRevisionLookup.php(55): Wikibase\Lib\Store\DispatchingEntityRevisionLookup->getEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/CachingEntityRevisionLookup.php(104): Wikibase\Lib\Store\TypeDispatchingEntityRevisionLookup->getEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#3 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/CachingEntityRevisionLookup.php(87): Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#4 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/CachingEntityRevisionLookup.php(104): Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#5 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/CachingEntityRevisionLookup.php(87): Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId, integer, string)
#6 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/lib/includes/Store/RevisionBasedEntityLookup.php(39): Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision(Wikibase\Lexeme\Domain\Model\LexemeId)
#7 /srv/mediawiki/php-1.34.0-wmf.15/vendor/wikibase/data-model-services/src/Lookup/RedirectResolvingEntityLookup.php(53): Wikibase\Lib\Store\RevisionBasedEntityLookup->getEntity(Wikibase\Lexeme\Domain\Model\LexemeId)
#8 /srv/mediawiki/php-1.34.0-wmf.15/extensions/WikibaseLexeme/src/MediaWiki/EntityLinkFormatters/LexemeLinkFormatter.php(90): Wikibase\DataModel\Services\Lookup\RedirectResolvingEntityLookup->getEntity(Wikibase\Lexeme\Domain\Model\LexemeId)
#9 /srv/mediawiki/php-1.34.0-wmf.15/extensions/WikibaseLexeme/src/MediaWiki/EntityLinkFormatters/LexemeLinkFormatter.php(72): Wikibase\Lexeme\MediaWiki\EntityLinkFormatters\LexemeLinkFormatter->getLemmas(Wikibase\Lexeme\Domain\Model\LexemeId)
#10 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererBeginHookHandler.php(253): Wikibase\Lexeme\MediaWiki\EntityLinkFormatters\LexemeLinkFormatter->getHtml(Wikibase\Lexeme\Domain\Model\LexemeId, NULL)
#11 /srv/mediawiki/php-1.34.0-wmf.15/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererBeginHookHandler.php(141): Wikibase\Repo\Hooks\HtmlPageLinkRendererBeginHookHandler->doHtmlPageLinkRendererBegin(MediaWiki\Linker\LinkRenderer, Title, NULL, array, RequestContext, NULL)
#12 /srv/mediawiki/php-1.34.0-wmf.15/includes/Hooks.php(174): Wikibase\Repo\Hooks\HtmlPageLinkRendererBeginHookHandler::onHtmlPageLinkRendererBegin(MediaWiki\Linker\LinkRenderer, Title, NULL, array, array, NULL)
#13 /srv/mediawiki/php-1.34.0-wmf.15/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#14 /srv/mediawiki/php-1.34.0-wmf.15/includes/linker/LinkRenderer.php(189): Hooks::run(string, array)
#15 /srv/mediawiki/php-1.34.0-wmf.15/includes/linker/LinkRenderer.php(260): MediaWiki\Linker\LinkRenderer->runBeginHook(Title, NULL, array, array, boolean)
#16 /srv/mediawiki/php-1.34.0-wmf.15/includes/linker/LinkRenderer.php(308): MediaWiki\Linker\LinkRenderer->makePreloadedLink(Title, NULL, string, array, array)
#17 /srv/mediawiki/php-1.34.0-wmf.15/includes/changes/RCCacheEntryFactory.php(138): MediaWiki\Linker\LinkRenderer->makeKnownLink(Title)
#18 /srv/mediawiki/php-1.34.0-wmf.15/includes/changes/RCCacheEntryFactory.php(69): RCCacheEntryFactory->buildCLink(RCCacheEntry)
#19 /srv/mediawiki/php-1.34.0-wmf.15/includes/changes/EnhancedChangesList.php(123): RCCacheEntryFactory->newFromRecentChange(RecentChange, boolean)
#20 /srv/mediawiki/php-1.34.0-wmf.15/includes/specials/SpecialRecentChanges.php(426): EnhancedChangesList->recentChangesLine(RecentChange, boolean, integer)
#21 /srv/mediawiki/php-1.34.0-wmf.15/includes/specialpage/ChangesListSpecialPage.php(1628): SpecialRecentChanges->outputChangesList(Wikimedia\Rdbms\ResultWrapper, FormOptions)
#22 /srv/mediawiki/php-1.34.0-wmf.15/includes/specialpage/ChangesListSpecialPage.php(671): ChangesListSpecialPage->webOutput(Wikimedia\Rdbms\ResultWrapper, FormOptions)
#23 /srv/mediawiki/php-1.34.0-wmf.15/includes/specials/SpecialRecentChanges.php(165): ChangesListSpecialPage->execute(NULL)
#24 /srv/mediawiki/php-1.34.0-wmf.15/includes/specialpage/SpecialPage.php(571): SpecialRecentChanges->execute(NULL)
#25 /srv/mediawiki/php-1.34.0-wmf.15/includes/specialpage/SpecialPageFactory.php(581): SpecialPage->run(NULL)
#26 /srv/mediawiki/php-1.34.0-wmf.15/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#27 /srv/mediawiki/php-1.34.0-wmf.15/includes/MediaWiki.php(892): MediaWiki->performRequest()
#28 /srv/mediawiki/php-1.34.0-wmf.15/includes/MediaWiki.php(523): MediaWiki->main()
#29 /srv/mediawiki/php-1.34.0-wmf.15/index.php(42): MediaWiki->run()
#30 /srv/mediawiki/w/index.php(3): include(string)
#31 {main}

It's basically because of a double redirect: L44373 ->L44168 -> L44166

RedirectResolvingEntityLookup doesn't handle double redirects, causing everything to explode majestically.

Lovely :P Thanks for figuring that out.

Nice catch. What's the solution? handling redirection chains (caution to account for possible cyclic-chain)? or something else like stopping at first redirect (whatever that means) regardless whether it is another redirect or not?

I think handling redirect chains makes sens conceptually, unless technicallly there's a blocker

alaa_wmde raised the priority of this task from High to Unbreak Now!.Jul 25 2019, 3:36 PM

Very important feature broken in production

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptJul 25 2019, 3:36 PM

I think handling redirect chains makes sens conceptually, unless technicallly there's a blocker

the only thing is that we definitely need to have a way to find redirect loops otherwise instead of a fatal, we end up bringing the whole website down by infinite loops. And finding loops when it's more than two is hard. My personal opinion as long-term wikimedian, we don't need more than one more check. (Get double redirects and be done with it)

Restricted Application added a project: User-Ladsgroup. · View Herald TranscriptJul 25 2019, 3:39 PM
LucasWerkmeister added a subscriber: LucasWerkmeister.

I don’t think Wikibase should follow the double redirect – that would go against longstanding Wikipedia tradition, and I don’t think Wikibase supports it for items either. Handle the error gracefully and move on, IMHO.

Jdforrester-WMF renamed this task from Internal error in Recent Changes for Lexeme namespace to Internal error in Recent Changes for Lexeme namespace due to double-redirect.Jul 25 2019, 3:49 PM

I don’t think Wikibase should follow the double redirect – that would go against longstanding Wikipedia tradition, and I don’t think Wikibase supports it for items either. Handle the error gracefully and move on, IMHO.

Yeah we should be consistent with what's being done on items.

I don’t think Wikibase should follow the double redirect – that would go against longstanding Wikipedia tradition, and I don’t think Wikibase supports it for items either. Handle the error gracefully and move on, IMHO.

This means a follow up on lexeme is to disallow double redirects as well. I wonder why we allow double-redirects on Lexmes when they are not supported by Wikibase.

It is a bit funny how it works on Wikibase right now.

  • I created three items Q534840 Q534841 and Q534842
  • I redirected Q534840 to Q534841
  • I redirected Q534841 to Q534842
  • now when I visit Q534840 I get redirected to Q534841 with an earlier revision before Q534841 was redirected to Q534842
  • when I visit Q534841 directly (or refresh the page from Q534840 to Q534841 redirection), I get redirected to Q534842

Now I try to redirect Q534840 to Q534841 again and it tells me that I cannot because Q534841 is already a redirect.


I tried the same steps on lexems (L3338 -> L3339 -> L3341) and it does allow me to create a double redirect indeed (also allows me to create a redirect on a non-empty source unlike Wikibase)


both feel counter intuitive .. why shouldn't I be able to redirect a redirect and follow on the chain in Wikibase? and if there's a reason, why should I still be able to create double-redirects in different revisions?

Note: when I tried to load L3337 a bit later, it actually didn't end up redirecting to L3338 on a revision prior to redirection, but rather loaded this page https://wikidata.beta.wmflabs.org/w/index.php?title=Lexeme:L3338&redirect=no. Not sure I get the whole logic behind this feature atm.


So what makes sense to me is still handling chains of redirections as one may expect. If they are not allowed in Wikibase, then the chain resolution isn't gonna be used anyway, but it will solve Lexeme's issue (lexeme might have reasons to allow double redirection?) and maybe other potential types.

Michael lowered the priority of this task from Unbreak Now! to High.Jul 26 2019, 3:42 PM

Recent changes appear to work fine for Lexemes for now: https://www.wikidata.org/wiki/Special:RecentChanges?hidebots=1&hidecategorization=1&namespace=146&limit=500&days=7&urlversion=2

Also, except from a spike yesterday, this error doesn't seem to occur that much: https://logstash.wikimedia.org/app/kibana#/dashboard/AWra4yyim2VjIW0682f0?_g=h@8b5b71a&_a=h@ef86cb1

This error should be fixed on Monday, but doesn't require weekend intervention, thus lowering the priority to "High". This happens in order to not crowd the "Unbreak Now!" priority for things that mighht pop up over the weekend.

Change 525855 had a related patch set uploaded (by Alaa Sarhan; owner: Alaa Sarhan):
[mediawiki/extensions/WikibaseLexeme@master] Avoid fataling on double-redirects when formatting Lexeme links.

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

Change 525855 had a related patch set uploaded (by Alaa Sarhan; owner: Alaa Sarhan):
[mediawiki/extensions/WikibaseLexeme@master] Avoid fataling on double-redirects when formatting Lexeme links.
https://gerrit.wikimedia.org/r/525855

Graceful handling (rendering using Lexeme ID instead of Lemmas for double-redirects)

Change 525855 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Avoid fataling on double-redirects when formatting Lexeme links.

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

Whoa! A bug? On Wikidata? Oh shoot!

alaa_wmde added a comment.EditedJul 29 2019, 10:27 AM

double checked on beta.

https://wikidata.beta.wmflabs.org/wiki/Lexeme:L3448 -> https://wikidata.beta.wmflabs.org/wiki/Lexeme:L3451 -> https://wikidata.beta.wmflabs.org/wiki/Lexeme:L3452

visiting what links here on L3451 (the double-redirect) or the destination L3452 used to crash .. now both would render, showing L3448 using its ID
https://wikidata.beta.wmflabs.org/w/index.php?title=Special%3AWhatLinksHere&target=Lexeme%3AL3451
https://wikidata.beta.wmflabs.org/w/index.php?title=Special%3AWhatLinksHere&target=Lexeme%3AL3452 (L3451 appears using the lemma of L3452, is that how it works on items .. can be that we need a follow up fix for this if it is important)

L3448 also appears with its ID in recent changes now
https://wikidata.beta.wmflabs.org/wiki/Special:RecentChanges?hidebots=1&hidecategorization=1&limit=500&days=30&urlversion=2

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