Page MenuHomePhabricator

TypeError: Argument 1 passed to Wikimedia\Stats\Metrics\CounterMetric::incrementBy() must be of the type float, null given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to Wikimedia\Stats\Metrics\CounterMetric::incrementBy() must be of the type float, null given, called in /srv/mediawiki/php-1.43.0-wmf.25/includes/page/ParserOutputAccess.php on line 469
FrameLocationCall
from/srv/mediawiki/php-1.43.0-wmf.25/includes/libs/Stats/Metrics/CounterMetric.php(75)
#0/srv/mediawiki/php-1.43.0-wmf.25/includes/page/ParserOutputAccess.php(469)Wikimedia\Stats\Metrics\CounterMetric->incrementBy(null)
#1/srv/mediawiki/php-1.43.0-wmf.25/includes/page/ParserOutputAccess.php(364)MediaWiki\Page\ParserOutputAccess->renderRevision(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, int, MediaWiki\Parser\ParserOutput)
#2/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(892)MediaWiki\Page\ParserOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, int)
#3/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(633)MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal(ParserOptions)
#4/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(558)MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#5/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler/RevisionHTMLHandler.php(111)MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getETag(string)
#6/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler.php(479)MediaWiki\Rest\Handler\RevisionHTMLHandler->getETag()
#7/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Handler.php(496)MediaWiki\Rest\Handler->getConditionalHeaderUtil()
#8/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Module/Module.php(380)MediaWiki\Rest\Handler->checkPreconditions()
#9/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Module/Module.php(269)MediaWiki\Rest\Module\Module->executeHandler(MediaWiki\Rest\Handler\RevisionHTMLHandler)
#10/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Router.php(488)MediaWiki\Rest\Module\Module->execute(string, MediaWiki\Rest\RequestFromGlobals)
#11/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/Router.php(447)MediaWiki\Rest\Router->doExecute(string, MediaWiki\Rest\RequestFromGlobals)
#12/srv/mediawiki/php-1.43.0-wmf.25/includes/Rest/EntryPoint.php(211)MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#13/srv/mediawiki/php-1.43.0-wmf.25/includes/MediaWikiEntryPoint.php(200)MediaWiki\Rest\EntryPoint->execute()
#14/srv/mediawiki/php-1.43.0-wmf.25/rest.php(39)MediaWiki\MediaWikiEntryPoint->run()
#15/srv/mediawiki/w/rest.php(3)require(string)
#16{main}
Impact
Notes

Seeing these since roughly 21:30 UTC. Fallout from https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/1077460 or https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1077792 ?

Event Timeline

Change #1077802 had a related patch set uploaded (by Brennen Bearnes; author: Brennen Bearnes):

[operations/mediawiki-config@master] Revert "Turn on Parsoid Selective Update metrics"

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

The root cause is probably

$timeStat->incrementBy( $output->getTimeProfile( 'cpu' ) );

I hadn't considered that ParserOutput::getTimeProfile could return null, but I guess there are some parse paths which are hitting this.

The quickest fix is probably to revert the mediawiki-config patch https://gerrit.wikimedia.org/r/1077460 which should prevent the error.

Change #1077802 merged by jenkins-bot:

[operations/mediawiki-config@master] Revert "Turn on Parsoid Selective Update metrics"

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

Mentioned in SAL (#wikimedia-operations) [2024-10-03T22:15:50Z] <brennen@deploy2002> Started scap sync-world: Backport for [[gerrit:1077802|Revert "Turn on Parsoid Selective Update metrics" (T376433)]]

The more proper, slower, fix would probably to fix the codepaths which don't record parse timing data; it looks like it's the REST API through HtmlOutputRendererHelper which is at fault here, but I should do a proper thorough audit (like we did for render id) to ensure that every parser path is calling ParserOutput::resetParseStartTime/::recordTimeProfile() at the appropriate points.

Mentioned in SAL (#wikimedia-operations) [2024-10-03T22:18:22Z] <brennen@deploy2002> Started scap sync-world: Backport for [[gerrit:1077802|Revert "Turn on Parsoid Selective Update metrics" (T376433)]]

The linked exception was coming from https://www.wikidata.org/w/rest.php/v1/revision/1961805404/html which is a non-wikitext content model I believe. So two learnings here: I should probably restrict the statistics to the wikitext content model, since I'm trying to measure parsoid optimization possibilities; and two although the time profile is recorded in the generic ContentHandler::getParserOutput(), I'm guessing that wikidata is doing 'something' in its implementation of ContentHandler::fillParserOutput() which is preventing the times from being successfully recorded.

(yeah, confirming these are all from wikidatawiki)

Mentioned in SAL (#wikimedia-operations) [2024-10-03T22:30:49Z] <brennen@deploy2002> Started scap sync-world: Backport for [[gerrit:1077802|Revert "Turn on Parsoid Selective Update metrics" (T376433)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-03T22:32:54Z] <brennen@deploy2002> brennen: Backport for [[gerrit:1077802|Revert "Turn on Parsoid Selective Update metrics" (T376433)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-03T22:37:53Z] <brennen@deploy2002> Finished scap sync-world: Backport for [[gerrit:1077802|Revert "Turn on Parsoid Selective Update metrics" (T376433)]] (duration: 07m 04s)

Change #1077805 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/Wikibase@master] Ensure ParserOutput::getTimeProfile() is valid for all ContentHandlers

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

Change #1077808 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] ParserOutput: ensure all created ParserOutputs have a "start of parse" time set

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

Change #1077810 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Parsoid selective update metrics: don't crash if no time profile available

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

Change #1078360 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/core@master] Document ParserOutput::resetParseStartTime() contract a bit more

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

Change #1077805 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Ensure ParserOutput::getTimeProfile() is valid for all ContentHandlers

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

Change #1078360 merged by jenkins-bot:

[mediawiki/core@master] Document ParserOutput::resetParseStartTime() contract a bit more

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

Change #1077808 merged by jenkins-bot:

[mediawiki/core@master] ParserOutput: ensure all created ParserOutputs have a "start of parse" time set

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

Change #1079274 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[operations/mediawiki-config@master] Turn on Parsoid Selective Update metrics (take 2)

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

Change #1079274 merged by jenkins-bot:

[operations/mediawiki-config@master] Turn on Parsoid Selective Update metrics (take 2)

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

Mentioned in SAL (#wikimedia-operations) [2024-10-10T13:20:59Z] <lucaswerkmeister-wmde@deploy2002> Started scap sync-world: Backport for [[gerrit:1075635|Turn on mobile support for Parsoid Read Views (but not on talk pages) (T269499 T376048)]], [[gerrit:1079274|Turn on Parsoid Selective Update metrics (take 2) (T371713 T376433)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-10T13:23:01Z] <lucaswerkmeister-wmde@deploy2002> lucaswerkmeister-wmde, cscott: Backport for [[gerrit:1075635|Turn on mobile support for Parsoid Read Views (but not on talk pages) (T269499 T376048)]], [[gerrit:1079274|Turn on Parsoid Selective Update metrics (take 2) (T371713 T376433)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-10T13:37:09Z] <lucaswerkmeister-wmde@deploy2002> Finished scap sync-world: Backport for [[gerrit:1075635|Turn on mobile support for Parsoid Read Views (but not on talk pages) (T269499 T376048)]], [[gerrit:1079274|Turn on Parsoid Selective Update metrics (take 2) (T371713 T376433)]] (duration: 16m 09s)

cscott claimed this task.

Change #1077810 abandoned by C. Scott Ananian:

[mediawiki/core@master] Parsoid selective update metrics: don't crash if no time profile available

Reason:

No longer needed.

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