Page MenuHomePhabricator

Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $pageId: must be greater than zero
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $pageId: must be greater than zero
exception.trace
from /srv/mediawiki/php-1.38.0-wmf.9/vendor/wikimedia/assert/src/Assert.php(72)
#0 /srv/mediawiki/php-1.38.0-wmf.9/includes/page/PageStore.php(292): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.38.0-wmf.9/includes/page/PageStore.php(326): MediaWiki\Page\PageStore->getPageById(integer, integer)
#2 /srv/mediawiki/php-1.38.0-wmf.9/includes/Title.php(4131): MediaWiki\Page\PageStore->getPageByReference(Title, integer)
#3 /srv/mediawiki/php-1.38.0-wmf.9/includes/Title.php(1100): Title->getFieldFromPageStore(string, integer)
#4 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Wikibase/data-access/src/ByTypeDispatchingEntityIdLookup.php(66): Title->getContentModel()
#5 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Wikibase/data-access/src/ByTypeDispatchingEntityIdLookup.php(60): Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup->getContentModelForTitle(Title)
#6 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Wikibase/client/includes/DataAccess/Scribunto/WikibaseLanguageIndependentLuaBindings.php(143): Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup->getEntityIdForTitle(Title)
#7 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Wikibase/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php(516): Wikibase\Client\DataAccess\Scribunto\WikibaseLanguageIndependentLuaBindings->getEntityId(string, string)
#8 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->getEntityId(string)
#9 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#10 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(115): LuaSandboxFunction->call(LuaSandboxFunction)
#11 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(298): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#12 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(68): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#13 /srv/mediawiki/php-1.38.0-wmf.9/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#14 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(3389): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#15 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(3072): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#16 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#17 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(3263): PPFrame_Hash->expand(PPNode_Hash_Tree)
#18 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPFrame_Hash)
#19 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(2908): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#20 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(1575): Parser->replaceVariables(string)
#21 /srv/mediawiki/php-1.38.0-wmf.9/includes/parser/Parser.php(693): Parser->internalParse(string)
#22 /srv/mediawiki/php-1.38.0-wmf.9/includes/content/WikitextContentHandler.php(294): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#23 /srv/mediawiki/php-1.38.0-wmf.9/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#24 /srv/mediawiki/php-1.38.0-wmf.9/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#25 /srv/mediawiki/php-1.38.0-wmf.9/includes/EditPage.php(4247): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, NULL, ParserOptions)
#26 /srv/mediawiki/php-1.38.0-wmf.9/includes/EditPage.php(4150): EditPage->doPreviewParse(WikitextContent)
#27 /srv/mediawiki/php-1.38.0-wmf.9/includes/EditPage.php(2924): EditPage->getPreviewText()
#28 /srv/mediawiki/php-1.38.0-wmf.9/includes/EditPage.php(723): EditPage->showEditForm()
#29 /srv/mediawiki/php-1.38.0-wmf.9/includes/actions/EditAction.php(71): EditPage->edit()
#30 /srv/mediawiki/php-1.38.0-wmf.9/includes/actions/SubmitAction.php(38): EditAction->show()
#31 /srv/mediawiki/php-1.38.0-wmf.9/includes/MediaWiki.php(538): SubmitAction->show()
#32 /srv/mediawiki/php-1.38.0-wmf.9/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#33 /srv/mediawiki/php-1.38.0-wmf.9/includes/MediaWiki.php(925): MediaWiki->performRequest()
#34 /srv/mediawiki/php-1.38.0-wmf.9/includes/MediaWiki.php(559): MediaWiki->main()
#35 /srv/mediawiki/php-1.38.0-wmf.9/index.php(53): MediaWiki->run()
#36 /srv/mediawiki/php-1.38.0-wmf.9/index.php(46): wfIndexMain()
#37 /srv/mediawiki/w/index.php(3): require(string)
#38 {main}
Impact

Upon deploying 1.38.0-wmf.9 to group1, 20 errors got logged in a few minutes, and rolled back due to suspected relation to risky patch https://gerrit.wikimedia.org/r/c/mediawiki/core/+/699067/

Notes

Event Timeline

jeena triaged this task as Unbreak Now! priority.Nov 17 2021, 9:03 PM
jeena created this task.

So, the code that's asserting is

if ( $page->exists() ) {
 // if we have a page ID, use it
 $id = $page->getId( $this->wikiId );
 return $this->getPageById( $id, $queryFlags );
}

In theory $page->exists() should ONLY return true if $pageId > 0. But, apparently not of course. I guess we can just replace $page->exists() with $pageId > 0. After all Title doesn't hold any invariant, why would it suddenly begin to uphold this one.

Change 739649 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[mediawiki/core@master] Don't trust Title that if it exists pageId will be > 0

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

Change 739638 had a related patch set uploaded (by Daniel Kinzler; author: Ppchelko):

[mediawiki/core@wmf/1.38.0-wmf.9] Don't trust Title that if it exists pageId will be > 0

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

In theory $page->exists() should ONLY return true if $pageId > 0. But, apparently not of course. I guess we can just replace $page->exists() with $pageId > 0. After all Title doesn't hold any invariant, why would it suddenly begin to uphold this one.

Task for fixing the root cause: T265775: Retire TitleExists hook

Change 739649 merged by jenkins-bot:

[mediawiki/core@master] Don't trust Title that if it exists pageId will be > 0

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

Change 739638 merged by jenkins-bot:

[mediawiki/core@wmf/1.38.0-wmf.9] Don't trust Title that if it exists pageId will be > 0

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

Mentioned in SAL (#wikimedia-operations) [2021-11-18T20:25:40Z] <jhuneidi@deploy1002> Synchronized php-1.38.0-wmf.9/includes/page/PageStore.php: Backport for T295931 (duration: 01m 04s)

Mentioned in SAL (#wikimedia-operations) [2021-11-18T20:27:42Z] <jhuneidi@deploy1002> Synchronized php-1.38.0-wmf.9/tests/phpunit/includes/page/PageStoreTest.php: Backport for T295931 (duration: 01m 03s)

jeena claimed this task.

Closing since I haven't seen any errors in the logs since deployment.