Page MenuHomePhabricator

Undefined property: Parser::$extTemplateStylesCache in /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.php on line 188
Closed, InvalidPublicPRODUCTION ERROR

Description

Seen in fatalmonitor

#0 /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.php(188): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.32.0-wmf.14/includes/Hooks.php(174): TemplateStylesHooks::onParserClearState(Parser)
#2 /srv/mediawiki/php-1.32.0-wmf.14/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#3 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(392): Hooks::run(string, array)
#4 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(4708): Parser->clearState()
#5 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(696): Parser->startParse(Title, ParserOptions, integer, boolean)
#6 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(4734): Parser->preprocess(string, Title, ParserOptions)
#7 /srv/mediawiki/php-1.32.0-wmf.14/includes/cache/MessageCache.php(1089): Parser->transformMsg(string, ParserOptions, Title)
#8 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(1281): MessageCache->transform(string, boolean, LanguageEn, Title)
#9 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(881): Message->transformText(string)
#10 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(941): Message->toString(string)
#11 /srv/mediawiki/php-1.32.0-wmf.14/includes/OutputPage.php(953): Message->text()
#12 /srv/mediawiki/php-1.32.0-wmf.14/includes/OutputPage.php(1001): OutputPage->setHTMLTitle(Message)
#13 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiFormatBase.php(256): OutputPage->setPageTitle(string)
#14 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiFormatRaw.php(85): ApiFormatBase->closePrinter()
#15 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(1809): ApiFormatRaw->closePrinter()
#16 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(598): ApiMain->printResult(integer)
#17 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(542): ApiMain->handleException(MWException)
#18 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(506): ApiMain->executeActionWithErrorHandling()
#19 /srv/mediawiki/php-1.32.0-wmf.14/api.php(83): ApiMain->execute()
#20 /srv/mediawiki/w/api.php(3): include(string)
#21 {main}

Event Timeline

Legoktm triaged this task as High priority.Aug 2 2018, 8:54 AM
Legoktm created this task.
Reedy renamed this task from Undefined property: Parser::$extTemplateStylesCache in /srv/medi awiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.p hp on line 188 to Undefined property: Parser::$extTemplateStylesCache in /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.p hp on line 188.Aug 2 2018, 8:55 AM
Reedy renamed this task from Undefined property: Parser::$extTemplateStylesCache in /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.p hp on line 188 to Undefined property: Parser::$extTemplateStylesCache in /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.php on line 188.

The line # corresponds to:

	public static function onParserClearState( Parser $parser ) {
		$parser->extTemplateStylesCache->clear();
	}

But in Parser::clearState(), it will call firstCallInit() if necessary, and there you have...

	public static function onParserFirstCallInit( &$parser ) {
		$parser->setHook( 'templatestyles', 'TemplateStylesHooks::handleTag' );
		$parser->extTemplateStylesCache = new MapCacheLRU( 100 ); // 100 is arbitrary
		return true;
	}

So it should always be set?

Also manifesting as...

2018-08-02 09:15:27 [W2LLrwpAAEoAAIQJBnEAAACK] mw1279 enwiki 1.32.0-wmf.14 exception ERROR: [W2LLrwpAAEoAAIQJBnEAAACK] /w/api.php   BadMethodCallException from line 188 of /srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.php: Call to a member function clear() on a non-object (null) {"exception_id":"W2LLrwpAAEoAAIQJBnEAAACK","exception_url":"/w/api.php","caught_by":"mwe_handler"} 
[Exception BadMethodCallException] (/srv/mediawiki/php-1.32.0-wmf.14/extensions/TemplateStyles/includes/TemplateStylesHooks.php:188) Call to a member function clear() on a non-object (null)
  #0 /srv/mediawiki/php-1.32.0-wmf.14/includes/Hooks.php(174): TemplateStylesHooks::onParserClearState(Parser)
  #1 /srv/mediawiki/php-1.32.0-wmf.14/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
  #2 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(392): Hooks::run(string, array)
  #3 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(4708): Parser->clearState()
  #4 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(696): Parser->startParse(Title, ParserOptions, integer, boolean)
  #5 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(4734): Parser->preprocess(string, Title, ParserOptions)
  #6 /srv/mediawiki/php-1.32.0-wmf.14/includes/cache/MessageCache.php(1089): Parser->transformMsg(string, ParserOptions, Title)
  #7 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(1281): MessageCache->transform(string, boolean, LanguageEn, Title)
  #8 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(881): Message->transformText(string)
  #9 /srv/mediawiki/php-1.32.0-wmf.14/includes/Message.php(941): Message->toString(string)
  #10 /srv/mediawiki/php-1.32.0-wmf.14/includes/OutputPage.php(953): Message->text()
  #11 /srv/mediawiki/php-1.32.0-wmf.14/includes/OutputPage.php(1001): OutputPage->setHTMLTitle(Message)
  #12 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiFormatBase.php(256): OutputPage->setPageTitle(string)
  #13 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiFormatRaw.php(85): ApiFormatBase->closePrinter()
  #14 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(1809): ApiFormatRaw->closePrinter()
  #15 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(598): ApiMain->printResult(integer)
  #16 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(542): ApiMain->handleException(MWException)
  #17 /srv/mediawiki/php-1.32.0-wmf.14/includes/api/ApiMain.php(506): ApiMain->executeActionWithErrorHandling()
  #18 /srv/mediawiki/php-1.32.0-wmf.14/api.php(83): ApiMain->execute()
  #19 /srv/mediawiki/w/api.php(3): include(string)
  #20 {main}

Something could mess with mFirstCall (yay for public properties) or return false from ParserFirstCallInit or replace the parser in ParserClearState. Codesearch doesn't find any of those in Wikimedia production, though.

No, it was a one-time thing, on last Thursday. Maybe some kind of deploy artifact with different versions of the code running in different contexts? Although that specific part of the code hasn't been touched for a year. Anyway, weird one-off, not worth the effort of investigating more unless it reoccurs.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM