Page MenuHomePhabricator

RevisionedUnresolvedRedirectException: Unresolved redirect from Q.. to Q.. (API and Job)
Open, MediumPublicPRODUCTION 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

Krinkle created this task.Jul 17 2019, 3:52 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 17 2019, 3:52 PM
Krinkle added a project: Wikidata-Campsite.
Addshore moved this task from Incoming to Needs Work on the Wikidata-Campsite board.

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.

Ladsgroup claimed this task.Sep 9 2019, 8:52 PM

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
Restricted Application added a project: User-Ladsgroup. · View Herald TranscriptSep 9 2019, 8:52 PM
Addshore claimed this task.Oct 29 2019, 1:34 PM
Addshore moved this task from Ready to pick up to Needs Work on the Wikidata-Campsite board.
Restricted Application added a project: User-Addshore. · View Herald TranscriptOct 29 2019, 1:34 PM

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 removed Addshore as the assignee of this task.May 5 2020, 11:55 AM
Addshore added a subscriber: Addshore.
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.

toan added a subscriber: toan.May 28 2020, 12:15 PM