Page MenuHomePhabricator

Wikimedia\Assert\PreconditionException: Precondition failed: This Title instance does not represent a proper page, but merely a link target.
Closed, ResolvedPublic3 Estimated Story PointsPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\PreconditionException: Precondition failed: This Title instance does not represent a proper page, but merely a link target.
Impact
Notes

Details

Request URL
https://commons.wikimedia.org/w/api.php?action=*&format=*&formatversion=*&cluster=*&from=*&limit=*&sequenceid=*&rerenderfrequency=*
Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
cirrusdoc: Handle unrenderable documentsrepos/search-platform/cirrus-streaming-updater!180ebernhardsonwork/ebernhardson/unrenderablemain
sanity: Accept redirect-in-index without a link targetrepos/search-platform/cirrus-streaming-updater!179ebernhardsonwork/ebernhardson/sanity-unindexable-redirectmain
Customize query in GitLab

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Gehel set the point value for this task to 3.Feb 10 2025, 4:45 PM

Change #1127158 had a related patch set uploaded (by Ebernhardson; author: Ebernhardson):

[mediawiki/extensions/CirrusSearch@master] sanity: redirect-in-index should skip unindexable link targets

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

Change #1127595 had a related patch set uploaded (by Ebernhardson; author: Ebernhardson):

[operations/deployment-charts@master] cirrus: Update container image

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

Change #1127595 merged by jenkins-bot:

[operations/deployment-charts@master] cirrus: Update container image

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

As for how these problems got into the search index in the first place, I think it's via the saneitizer.

If we have a redirect:

> MediaWiki\Title\Title::newFromText('UDP Hole Punching')->isRedirect()
= true

> MediaWiki\Title\Title::newFromText('UDP Hole Punching')->getArticleID()
= 2632384

And we ask cirrus-check-sanity if everything is correct about the way it's indexed it gets reported as an oldDocument which triggers a rerender:
https://en.wikipedia.org/w/api.php?action=cirrus-check-sanity&format=json&from=2632384&limit=1&sequenceid=0&rerenderfrequency=2&formatversion=2

{
    "wikiId": "enwiki",
    "clusterGroup": "chi",
    "problems": [
        {
            "indexName": "enwiki_content",
            "errorType": "oldDocument",
            "pageId": 2632384,
            "namespaceId": 0
        }
    ]
}

That rerender results in a document to be indexed, even though redirects shouldn't be indexed directly:
https://en.wikipedia.org/w/api.php?action=query&format=json&prop=cirrusbuilddoc&pageids=2632384&formatversion=2

{
    "batchcomplete": true,
    "query": {
        "pages": [
            {
                "pageid": 2632384,
                "ns": 0,
                "title": "UDP Hole Punching",
                "cirrusbuilddoc": {
...

To resolve I'm putting together a few patches:

  • Fix cirrus-check-sanity to not report redirects as old documents
  • Fix cirrusbuilddoc to return an unrenderable flag instead of a document when asked to render a redirect
  • Fix SUP to understand the unrenderable flag and route the potential update to the fetch-failure topic

The main part I still don't understand is how we have so few redirects indexed. With the saneitizer on a 1:8 oldDocument, i would expect 1/8 of all redirects in all wikis to be in the index, and thus triggering redirectInIndex errors the following loop. But according to Saneitizer Bi-Weekly Fix Rate by Problem Type we only see 2k-3k of this problem type per loop.

Change #1127974 had a related patch set uploaded (by Ebernhardson; author: Ebernhardson):

[mediawiki/extensions/CirrusSearch@master] Don't build a document for redirects

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

Change #1127158 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] sanity: redirect-in-index should skip unindexable link targets

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

Change #1128505 had a related patch set uploaded (by Ebernhardson; author: Ebernhardson):

[operations/deployment-charts@master] cirrus: Update container image

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

Change #1128505 merged by jenkins-bot:

[operations/deployment-charts@master] cirrus: Update container image

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

Change #1127974 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] Don't build a document for redirects

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