Page MenuHomePhabricator

RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job)
Closed, InvalidPublicPRODUCTION ERROR

Description

Problem
Double redirects on items are not resolved by our lookups (as seen in the exception log below).

We currently have this bot https://www.wikidata.org/wiki/User:Dexbot to resolve those double-redirects statically (changing them into single direct redirects instead).

Between creating a double-redirect and the bot resolving them, we see some exceptions appearing in our logs due to accessing those entities at the front end of the double redirect (the first in the chain).

Suggested investigation
It seems that most those errors happen in requests to wbgetsuggestions module as seen in https://logstash.wikimedia.org/goto/7ccd10e39a14d3b608f2122d9c1c1a01.

  • Investigate whether there's a way to handle those exception in that module gracefully, by maybe excluding those items or defaulting back to something meaningful.

For inspiration, we had to handle that exception in Lexeme gracefully for same reason here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikibaseLexeme/+/525855

timebox investigation to 4 hours


(previous description)

Error

Request URL: api.php
Request ID: uApAICoAAJLcp3kAAAAX

message
Wikibase\Lib\Store\RevisionedUnresolvedRedirectException:
Unresolved redirect from Q… to Q…
api trace
#0 /srv/mediawiki/php-1.34.0-wmf.13/extensions/Wikibase/lib/includes/Store/DispatchingEntityRevisionLookup.php(59): Wikibase\Lib\Store\Sql\WikiPageEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#1 /srv/mediawiki/php-1.34.0-wmf.13/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityRevisionLookup.php(55): Wikibase\Lib\Store\DispatchingEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.13/extensions/Wikibase/repo/includes/Api/ModifyEntity.php(192): Wikibase\Lib\Store\TypeDispatchingEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#3 /srv/mediawiki/php-1.34.0-wmf.13/extensions/Wikibase/repo/includes/Api/SetLabel.php(62): Wikibase\Repo\Api\ModifyEntity->applyChangeOp(Wikibase\Repo\ChangeOp\ChangeOpLabel, Wikibase\DataModel\Entity\Item, Wikibase\Summary)
#4 /srv/mediawiki/php-1.34.0-wmf.13/extensions/Wikibase/repo/includes/Api/ModifyEntity.php(298): Wikibase\Repo\Api\SetLabel->modifyEntity(Wikibase\DataModel\Entity\Item, Wikibase\Repo\ChangeOp\ChangeOpLabel, array)
#5 /srv/mediawiki/php-1.34.0-wmf.13/includes/api/ApiMain.php(1583): Wikibase\Repo\Api\ModifyEntity->execute()
#6 /srv/mediawiki/php-1.34.0-wmf.13/includes/api/ApiMain.php(531): ApiMain->executeAction()
#7 /srv/mediawiki/php-1.34.0-wmf.13/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#8 /srv/mediawiki/php-1.34.0-wmf.13/api.php(86): ApiMain->execute()
#9 /srv/mediawiki/w/api.php(3): include(string)
#10 {main}

And another trace, from an instance found on jobrunners:

jobrunner trace
#0 /srv/mediawiki/php-1.34.0-wmf.14/extensions/Wikibase/lib/includes/Store/DispatchingEntityRevisionLookup.php(59): Wikibase\Lib\Store\Sql\WikiPageEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#1 /srv/mediawiki/php-1.34.0-wmf.14/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityRevisionLookup.php(55): Wikibase\Lib\Store\DispatchingEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.14/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php(102): Wikibase\Lib\Store\TypeDispatchingEntityRevisionLookup->getEntityRevision(Wikibase\DataModel\Entity\ItemId, integer, string)
#3 /srv/mediawiki/php-1.34.0-wmf.14/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php(195): Wikibase\Repo\UpdateRepo\UpdateRepoJob->getItem()
#4 /srv/mediawiki/php-1.34.0-wmf.14/extensions/EventBus/includes/JobExecutor.php(64): Wikibase\Repo\UpdateRepo\UpdateRepoJob->run()
#5 /srv/mediawiki/rpc/RunSingleJob.php(76): JobExecutor->execute(array)
#6 {main}

Impact

Some API user requests and JobQueue jobs are fatally aborted. Whether they are intermittent or deterministic is not yet known.

Notes

From Logstash:

  • Since since at least 1.34-wmf.8 (30+ days ago).
  • Affects wikidata.org only.
  • Both PHP7 and HHVM.

Event Timeline

Likely to have been solved already. Close as resolved if not found in the logs from last 2 weeks.

These errors still appear in our logs. https://logstash.wikimedia.org/goto/7ccd10e39a14d3b608f2122d9c1c1a01

Most errors happening on calls to wbsgetsuggestions module.

Those items that cause such calls to fail, will recover after a while due to a bot that resolves and fixes those double-redirects into single-redirects on Wikidata. A possible solution for avoiding those failures on double-redirects before they have been resolved on that module can be investigated.

alaa_wmde renamed this task from RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job) to [4h invstigation] RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job).Aug 26 2019, 1:59 PM
alaa_wmde triaged this task as Medium priority.
alaa_wmde updated the task description. (Show Details)
alaa_wmde moved this task from Needs Work to Ready to pick up on the Wikidata-Campsite board.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:06 PM

Looking at the errors, it only happen on apps now (not on jobs anymore). I will debug this slightly further.

Steps to reproduce:

  • Make an item (let's say Q231 with revision id 730)
  • Merge it to another item. Let's say you merge it and now it has revision id of 731 redirecting to Q228
  • Try setting English label or description using wbset(label|description) and not with wbeditentity and set baserevid=730 (before redirect)
  • Ta-duh

When trying this out on test I now get a lovely error message and no exception:

{
    "error": {
        "code": "unresolved-redirect",
        "info": "The given entity ID refers to a redirect, which is not supported in this context.",
        "messages": [
            {
                "name": "wikibase-api-unresolved-redirect",
                "parameters": [],
                "html": {
                    "*": "The given entity ID refers to a redirect, which is not supported in this context."
                }
            }
        ],
        "*": "See https://test.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
    },
    "servedby": "mw1344"
}

However looking in the logs I see this in a few other places:

So we still need to tackle this logspam.

Addshore renamed this task from [4h invstigation] RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job) to RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job).May 5 2020, 12:31 PM

Span off the 3 identified cases for now into ticket for the campsite iteration.
Moving this main task to waiting while those are completed.

Another one:

Unresolved redirect from Q104821940 to Q56305763
/w/rest.php/en.wikipedia.org/v3/page/pagebundle/Template%3AISO_15924%2Fqid/1003335501
Wikibase\DataModel\Services\Lookup\UnresolvedEntityRedirectException: Unresolved redirect from Q104821940 to Q56305763
from /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Store/RevisionBasedEntityLookup.php(81)
#0 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Store/LatestRevisionIdResult.php(157): Wikibase\Lib\Store\RevisionBasedEntityLookup->Wikibase\Lib\Store\{closure}(integer, Wikibase\DataModel\Entity\ItemId)
#1 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Store/RevisionBasedEntityLookup.php(83): Wikibase\Lib\Store\LatestRevisionIdResult->map()
#2 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikibase/data-model-services/src/Lookup/RedirectResolvingEntityLookup.php(72): Wikibase\Lib\Store\RevisionBasedEntityLookup->hasEntity(Wikibase\DataModel\Entity\ItemId)
#3 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikibase/data-model-services/src/Lookup/DisabledEntityTypesEntityLookup.php(69): Wikibase\DataModel\Services\Lookup\RedirectResolvingEntityLookup->hasEntity(Wikibase\DataModel\Entity\ItemId)
#4 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikibase/data-model-services/src/Lookup/RestrictedEntityLookup.php(93): Wikibase\DataModel\Services\Lookup\DisabledEntityTypesEntityLookup->hasEntity(Wikibase\DataModel\Entity\ItemId)
#5 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php(193): Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup->hasEntity(Wikibase\DataModel\Entity\ItemId)
#6 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php(508): Wikibase\Client\DataAccess\Scribunto\EntityAccessor->entityExists(string)
#7 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->entityExists(string)
#8 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#9 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(113): LuaSandboxFunction->call(LuaSandboxFunction)
#10 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(296): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#11 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(68): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#12 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#13 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3358): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#14 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3043): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#15 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#16 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3232): PPFrame_Hash->expand(PPNode_Hash_Tree)
#17 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#18 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3232): PPFrame_Hash->expand(PPNode_Hash_Tree)
#19 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#20 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3232): PPFrame_Hash->expand(PPNode_Hash_Tree)
#21 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#22 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPTemplateFrame_Hash.php(90): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#23 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3229): PPTemplateFrame_Hash->cachedExpand(string, PPNode_Hash_Tree)
#24 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#25 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPTemplateFrame_Hash.php(90): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#26 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3229): PPTemplateFrame_Hash->cachedExpand(string, PPNode_Hash_Tree)
#27 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#28 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPTemplateFrame_Hash.php(171): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#29 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPTemplateFrame_Hash.php(183): PPTemplateFrame_Hash->getNamedArgument(string)
#30 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(679): PPTemplateFrame_Hash->getArgument(string)
#31 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Scribunto_LuaEngine->getExpandedArgument(string, string)
#32 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#33 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(113): LuaSandboxFunction->call(LuaSandboxFunction)
#34 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(296): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#35 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(68): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#36 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#37 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3358): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#38 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3043): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#39 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#40 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPTemplateFrame_Hash.php(90): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#41 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(3229): PPTemplateFrame_Hash->cachedExpand(string, PPNode_Hash_Tree)
#42 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/PPFrame_Hash.php(255): Parser->braceSubstitution(array, PPFrame_Hash)
#43 /srv/mediawiki/php-1.36.0-wmf.27/includes/parser/Parser.php(2881): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#44 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/extension/src/Config/DataAccess.php(295): Parser->replaceVariables(string)
#45 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1168): MWParsoid\Config\DataAccess->preprocessWikitext(MWParsoid\Config\PageConfig, string)
#46 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1514): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->fetchExpandedTpl(string)
#47 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1577): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTemplate(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#48 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(202): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#49 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(123): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#50 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(195): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#51 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(193): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#52 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/HTML5TreeBuilder.php(417): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#53 [internal function]: Wikimedia\Parsoid\Wt2Html\HTML5TreeBuilder->processChunkily(string, array)
#54 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(920): Generator->current()
#55 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(174): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#56 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(235): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#57 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc(string, array)
#58 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Core/WikitextContentModelHandler.php(106): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#59 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Parsoid.php(162): Wikimedia\Parsoid\Core\WikitextContentModelHandler->toDOM(Wikimedia\Parsoid\Config\Env)
#60 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/src/Parsoid.php(194): Wikimedia\Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#61 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php(589): Wikimedia\Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#62 /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(88): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(MWParsoid\Config\PageConfig, array)
#63 /srv/mediawiki/php-1.36.0-wmf.27/includes/Rest/Router.php(389): MWParsoid\Rest\Handler\PageHandler->execute()
#64 /srv/mediawiki/php-1.36.0-wmf.27/includes/Rest/Router.php(316): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#65 /srv/mediawiki/php-1.36.0-wmf.27/includes/Rest/EntryPoint.php(152): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#66 /srv/mediawiki/php-1.36.0-wmf.27/includes/Rest/EntryPoint.php(117): MediaWiki\Rest\EntryPoint->execute()
#67 /srv/mediawiki/php-1.36.0-wmf.27/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#68 /srv/mediawiki/w/rest.php(3): require(string)
#69 {main}

Occurences of UnresolvedEntityRedirectException in the last 90 days:


from: https://logstash.wikimedia.org/goto/887045bfef70f63d31994d8b04b8d6ff

I have split the last reported occurrence into T282534: Unresolved redirect in Wikibase LUA code, in v3/page/pagebundle
This ticket has become a bit of a kitchen sink,. so closing it and will track this last occurrence there.