Page MenuHomePhabricator

Recursive parser calls
Closed, ResolvedPublic

Description

2014-05-27 11:30:54 mw1166 metawiki: [68d48737] [no req] Exception from line 6291 of /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php: Parser state cleared while parsing. Did you call Parser::parse recursively?
#0 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php(375): Parser->lock()
#1 /usr/local/apache/common-local/php-1.24wmf5/includes/OutputPage.php(1609): Parser->parse('<div class='err...', Object(Title), Object(ParserOptions), true, true, NULL)
#2 /usr/local/apache/common-local/php-1.24wmf5/includes/OutputPage.php(1549): OutputPage->addWikiTextTitle('<div class='err...', Object(Title), true, false, true)
#3 /usr/local/apache/common-local/php-1.24wmf5/includes/OutputPage.php(3775): OutputPage->addWikiText('<div class='err...')
#4 /usr/local/apache/common-local/php-1.24wmf5/extensions/Translate/specials/SpecialLanguageStats.php(165): OutputPage->wrapWikiMsg('<div class='err...', 'translate-mgs-n...')
#5 /usr/local/apache/common-local/php-1.24wmf5/includes/specialpage/SpecialPage.php(379): SpecialLanguageStats->execute(NULL)
#6 /usr/local/apache/common-local/php-1.24wmf5/includes/specialpage/SpecialPageFactory.php(507): SpecialPage->run(NULL)
#7 /usr/local/apache/common-local/php-1.24wmf5/includes/specialpage/SpecialPageFactory.php(546): SpecialPageFactory::executePath(Object(Title), Object(RequestContext), true)
#8 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php(3494): SpecialPageFactory::capturePath(Object(Title), Object(RequestContext))
#9 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Preprocessor_DOM.php(1153): Parser->braceSubstitution(Array, Object(PPFrame_DOM))
#10 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php(3226): PPFrame_DOM->expand(Object(PPNode_DOM), 0)
#11 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php(1238): Parser->replaceVariables('{{process heade...')
#12 /usr/local/apache/common-local/php-1.24wmf5/includes/parser/Parser.php(406): Parser->internalParse('{{process heade...')
#13 /usr/local/apache/common-local/php-1.24wmf5/includes/content/WikitextContent.php(327): Parser->parse('{{process heade...', Object(Title), Object(ParserOptions), true, true, 8234361)
#14 /usr/local/apache/common-local/php-1.24wmf5/includes/content/AbstractContent.php(486): WikitextContent->fillParserOutput(Object(Title), 8234361, Object(ParserOptions), true, Object(ParserOutput))
#15 /usr/local/apache/common-local/php-1.24wmf5/includes/WikiPage.php(3648): AbstractContent->getParserOutput(Object(Title), 8234361, Object(ParserOptions))
#16 /usr/local/apache/common-local/php-1.24wmf5/includes/poolcounter/PoolCounterWork.php(116): PoolWorkArticleView->doWork()
#17 /usr/local/apache/common-local/php-1.24wmf5/includes/Article.php(703): PoolCounterWork->execute()
#18 /usr/local/apache/common-local/php-1.24wmf5/includes/actions/ViewAction.php(44): Article->view()
#19 /usr/local/apache/common-local/php-1.24wmf5/includes/Wiki.php(431): ViewAction->show()
#20 /usr/local/apache/common-local/php-1.24wmf5/includes/Wiki.php(295): MediaWiki->performAction(Object(Article), Object(Title))
#21 /usr/local/apache/common-local/php-1.24wmf5/includes/Wiki.php(599): MediaWiki->performRequest()
#22 /usr/local/apache/common-local/php-1.24wmf5/includes/Wiki.php(451): MediaWiki->main()
#23 /usr/local/apache/common-local/php-1.24wmf5/index.php(46): MediaWiki->run()
#24 /usr/local/apache/common-local/w/index.php(3): require('/usr/local/apac...')
#25 {main}


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=56226

Details

Reference
bz65826

Related Objects

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 3:09 AM
bzimport set Reference to bz65826.
aaron created this task.May 27 2014, 5:41 PM

(Information how often this happens welcome for judging how urgent it is to fix)

What would be the am appropriate fix? Are special pages no longer allowed to use OutputPage::addWikiMsg and wrapWikiMsg?

(In reply to Niklas Laxström from comment #2)

What would be the am appropriate fix? Are special pages no longer allowed to
use OutputPage::addWikiMsg and wrapWikiMsg?

OutputPage::addWikiMsg is fine. However OutputPage::wrapWikiMsg (along with OutputPage::addWikiText, OutputPage::addWikiTextTitle) never worked correctly when used from a special page that was being transcluded on a real page.

aaron added a comment.May 28 2014, 7:22 PM

It's a huge chunk of the exception log now.

(In reply to Niklas Laxström from comment #2)

What would be the am appropriate fix? Are special pages no longer allowed to
use OutputPage::addWikiMsg and wrapWikiMsg?

See https://www.mediawiki.org/wiki/Manual:Special_pages#OutputPage-.3EaddWikiText.28.29

"If your special page is intended to be included in other pages, you should probably not use addWikiText() (or any other function that calls the parser. Message). Due to a bug in MediaWiki (Bug 16129), an included special page will mess up any inclusion before it on the same including page, showing strings like UNIQ10842e596cbb71da."

Okay. It should be easy to not use those functions at all or at least not when transcluding the special page.

  • Bug 51346 has been marked as a duplicate of this bug. ***

I'm seeing a similar error with 1.24wmf4 and Semantic Forms 2.7. This is the message I get when trying to use a Special:RunQuery embeded in a page.

MediaWiki internal error.

Original exception: [c01a2a06] [no req] Exception from line 6391 of /var/www/html/w/includes/parser/Parser.php: Parser state cleared while parsing. Did you call Parser::parse recursively?
Backtrace:
#0 /var/www/html/w/includes/parser/Parser.php(475): Parser->lock()
#1 /var/www/html/w/extensions/SemanticForms/includes/SF_FormUtils.php(425): Parser->parse(string, Title, ParserOptions)
#2 /var/www/html/w/extensions/SemanticForms/includes/SF_FormPrinter.php(500): SFFormUtils::getFormDefinition(Parser, string, integer)
#3 /var/www/html/w/extensions/SemanticForms/specials/SF_RunQuery.php(79): SFFormPrinter->formHTML(string, boolean, boolean, integer, NULL, NULL, NULL, boolean, boolean)
#4 /var/www/html/w/extensions/SemanticForms/specials/SF_RunQuery.php(30): SFRunQuery->printPage(string, boolean)
#5 /var/www/html/w/includes/specialpage/SpecialPage.php(379): SFRunQuery->execute(string)
#6 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(507): SpecialPage->run(string)
#7 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(546): SpecialPageFactory::executePath(Title, RequestContext, boolean)
#8 /var/www/html/w/includes/parser/Parser.php(3594): SpecialPageFactory::capturePath(Title, RequestContext)
#9 /var/www/html/w/includes/parser/Preprocessor_DOM.php(1165): Parser->braceSubstitution(array, PPTemplateFrame_DOM)
#10 /var/www/html/w/includes/parser/Parser.php(3673): PPFrame_DOM->expand(PPNode_DOM)
#11 /var/www/html/w/includes/parser/Preprocessor_DOM.php(1165): Parser->braceSubstitution(array, PPFrame_DOM)
#12 /var/www/html/w/includes/parser/Parser.php(3326): PPFrame_DOM->expand(PPNode_DOM, integer)
#13 /var/www/html/w/includes/parser/Parser.php(1338): Parser->replaceVariables(string)
#14 /var/www/html/w/includes/parser/Parser.php(506): Parser->internalParse(string)
#15 /var/www/html/w/extensions/SemanticForms/specials/SF_RunQuery.php(99): Parser->parse(string, Title, ParserOptions)
#16 /var/www/html/w/extensions/SemanticForms/specials/SF_RunQuery.php(30): SFRunQuery->printPage(string, boolean)
#17 /var/www/html/w/includes/specialpage/SpecialPage.php(379): SFRunQuery->execute(string)
#18 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(507): SpecialPage->run(string)
#19 /var/www/html/w/includes/Wiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#20 /var/www/html/w/includes/Wiki.php(599): MediaWiki->performRequest()
#21 /var/www/html/w/includes/Wiki.php(451): MediaWiki->main()
#22 /var/www/html/w/index.php(46): MediaWiki->run()
#23 {main}

Exception caught inside exception handler: [37f9f47f] [no req] Exception from line 1334 of /var/www/html/w/includes/WebRequest.php: FauxRequest::getRequestURL() not implemented
Backtrace:
#0 /var/www/html/w/includes/WebRequest.php(1385): FauxRequest->notImplemented(string)
#1 /var/www/html/w/includes/SkinTemplate.php(1162): FauxRequest->getRequestURL()
#2 /var/www/html/w/includes/SkinTemplate.php(534): SkinTemplate->buildContentNavigationUrls()
#3 /var/www/html/w/includes/SkinTemplate.php(257): SkinTemplate->prepareQuickTemplate(OutputPage)
#4 /var/www/html/w/includes/OutputPage.php(2146): SkinTemplate->outputPage()
#5 /var/www/html/w/includes/exception/MWException.php(220): OutputPage->output()
#6 /var/www/html/w/includes/exception/MWException.php(263): MWException->reportHTML()
#7 /var/www/html/w/includes/exception/MWExceptionHandler.php(45): MWException->report()
#8 /var/www/html/w/includes/exception/MWExceptionHandler.php(141): MWExceptionHandler::report(MWException)
#9 /var/www/html/w/includes/Wiki.php(465): MWExceptionHandler::handle(MWException)
#10 /var/www/html/

Please file a separate bug for each extension. For now it is easier to fix this in each extension separately.

I suppose we could temporarily replace $wgParser with a new Parser object in SpecialPageFactory::capturePath. Not sure if its worth it. The OutputPage methods are really the only methods left where this is an issue.

Change 141056 had a related patch set uploaded by Brian Wolff:
Prevent OutputPage::addWikiText and friends from causing UNIQ fails

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

Change 141056 merged by jenkins-bot:
Prevent OutputPage::addWikiText and friends from causing UNIQ fails

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

Approved by Nikerabbit and translatewiki.net didn't explode.