Page MenuHomePhabricator

Wikimedia\Assert\PostconditionException: Postcondition failed: makeTitleSafe() should always return a Title for the text returned by getRootText().
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\PostconditionException: Postcondition failed: makeTitleSafe() should always return a Title for the text returned by getRootText().
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.17/vendor/wikimedia/assert/src/Assert.php(202)
#0 /srv/mediawiki/php-1.37.0-wmf.17/includes/Title.php(2053): Wikimedia\Assert\Assert::postcondition(boolean, string)
#1 /srv/mediawiki/php-1.37.0-wmf.17/includes/skins/Skin.php(518): Title->getRootTitle()
#2 /srv/mediawiki/php-1.37.0-wmf.17/includes/OutputPage.php(3147): Skin->getPageClasses(Title)
#3 /srv/mediawiki/php-1.37.0-wmf.17/includes/skins/SkinTemplate.php(411): OutputPage->headElement(SkinTimeless)
#4 /srv/mediawiki/php-1.37.0-wmf.17/includes/skins/SkinTemplate.php(130): SkinTemplate->prepareQuickTemplate()
#5 /srv/mediawiki/php-1.37.0-wmf.17/includes/skins/SkinTemplate.php(147): SkinTemplate->generateHTML()
#6 /srv/mediawiki/php-1.37.0-wmf.17/includes/OutputPage.php(2644): SkinTemplate->outputPage()
#7 /srv/mediawiki/php-1.37.0-wmf.17/includes/MediaWiki.php(939): OutputPage->output(boolean)
#8 /srv/mediawiki/php-1.37.0-wmf.17/includes/MediaWiki.php(952): MediaWiki::{closure}()
#9 /srv/mediawiki/php-1.37.0-wmf.17/includes/MediaWiki.php(559): MediaWiki->main()
#10 /srv/mediawiki/php-1.37.0-wmf.17/index.php(53): MediaWiki->run()
#11 /srv/mediawiki/php-1.37.0-wmf.17/index.php(46): wfIndexMain()
#12 /srv/mediawiki/w/index.php(3): require(string)
#13 {main}
Impact
Notes
  • Happening exclusively on wikimaniawiki currently

Details

Request URL
https://wikimania.wikimedia.org/w/index.php?title=*&oldid=*

Event Timeline

Note that all the errors are for something like Talk:2021:Submissions with quite old oldie.

Talk:2021:Submissions is not a valid title on wikimania wiki, e.g. https://wikimania.wikimedia.org/w/index.php?title=Talk:2021:Submissions

But at some point I suppose it was since there is an entry in page table for it, and 2 revisions that belong to it. It obviously shouldn't crash though, but it doesn't seem as serious as from the first glance.

So, in MediaWiki::parseTitle we try creating a Title with validation, then we look if ?oldid parameter is set, we fetch a revision and we blindly trust that if there's a revision in the database, its title must be valid, so we instantiate one using Title::makeTitle - no validation. This title is used as context title.

Then skin tries to do something with it, in this case get a root page, but the title's invalid, so it crashes.

This is probably cause by some changes in wikimaniawiki configuration - some namespaces perhaps were added or renamed. I'm not really sure what to do - not trusting the database and revalidating that the title that comes from page_namespace and page_title is valid seems like an overkill. Maybe we can just delete 2 faulty revisions and the faulty page table record?

There's a maintenance script to fix the page entries. It should have been run after the 2021 namespace was added (T284235). Apparently this was done in T284442 though. Maybe the real issue is a bug in that script? Or maybe this revision was undeleted after that script ran, or something?

There's a maintenance script to fix the page entries. It should have been run after the 2021 namespace was added (T284235). Apparently this was done in T284442 though. Maybe the real issue is a bug in that script? Or maybe this revision was undeleted after that script ran, or something?

Maybe @DannyS712 or @Urbanecm have some insight into namespaceDupes.php that would instantly explain this.

It seems like the namespacesDupes have a move-talk option that doesn't seem to have been used in T284442. Without it the script only looks for pages in the main namespace, and our problematic page appears to be in the Talk namespace.

I would agree, the solution is probably running mwscript namespaceDupes.php --wiki=wikimaniawiki --fix --move-talk.

Mentioned in SAL (#wikimedia-operations) [2021-08-11T20:30:24Z] <urbanecm> [urbanecm@mwmaint2002 ~]$ mwscript namespaceDupes.php --wiki=wikimaniawiki --move-talk --add-prefix=T288643 --fix # T288643

I would agree, the solution is probably running mwscript namespaceDupes.php --wiki=wikimaniawiki --fix --move-talk.

had to pass --add-prefix too, but...it appears to fix the exception.

We should probably update https://wikitech.wikimedia.org/wiki/Backport_windows/Deployers#namespaceDupes as well to instruct people to pass --move-talk (or maybe move it a default option? Is there any reason to intentionally ignore talk pages?).

Hmm...Maybe something new weird is happening now. https://wikimania.wikimedia.org/w/index.php?oldid=95544 looks like this to me:

image.png (745×1 px, 69 KB)

However, clicking on the "Discussion" tab brings me to https://wikimania.wikimedia.org/wiki/2021_talk:T288643Submissions (note different title from the screenshot). Same with view history, etc.

The same URL (the one with oldid param) displays fine in an inkognito window and in another browser, so maybe it's a cache issue I can't get rid of.

looks the same to me both with old_id and with title, so might be some caches you're hitting. Can check curl -i 'https://wikimania.wikimedia.org/w/index.php?oldid=95544' | grep x-cache if you want, but I think this can be resolved now.

For me it does show 2021 talk:T288643Submissions directly, so probably some cache as @Pchelolo supposed.

Urbanecm claimed this task.

looks the same to me both with old_id and with title, so might be some caches you're hitting. Can check curl -i 'https://wikimania.wikimedia.org/w/index.php?oldid=95544' | grep x-cache if you want, but I think this can be resolved now.

I think logged in users are supposed to bypass cp* caches. x-cache: cp3058 miss, cp3056 pass is the value of that header. Agree with resolving though.

I still think MW should be handling this better, even if this specific case is fixed...