Page MenuHomePhabricator

MobileFrontend commits fail in qunit in Jenkins
Closed, ResolvedPublic

Description

Event Timeline

Amire80 raised the priority of this task from to High.
Amire80 updated the task description. (Show Details)
Amire80 added subscribers: Amire80, Jdlrobson, hashar.

Change 198655 had a related patch set uploaded (by Krinkle):
Migrate mobile-qunit jobs to new CI slaves in labs

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

It seems like there's quite a few different errors that have accumulated. The first one I see in the logs is a PHP syntax error coming from TemplateParser's eval().

I can reproduce it locally latest master of MediaWiki, MobileFrontend and Mantle (which is what Jenkins is programmed to do, no other extensions or even a default skin). However I can only reproduce it on the first request. It seems subsequent http requests bypass the error. So perhaps something with how TemplateParser handles the cache and how the cache miss (first hit) is handled incorrectly.

Visiting http://mediawiki.dev/wiki/Special:JavaScriptTest/qunit?useformat=mobile consistently yields the following after clearing the cache (e.g. by running maintenance/update.php):

Parse error: syntax error, unexpected 'return' (T_RETURN) in mediawiki/includes/TemplateParser.php(136) : eval()'d code on line 1
Exception encountered, of type "RuntimeException"
[a5b9e0ae] /wiki/Special:JavaScriptTest/qunit?useformat=mobile RuntimeException from line 138 of mediawiki/includes/TemplateParser.php: Requested template, header, is not callable
Backtrace:
#0 mediawiki/includes/TemplateParser.php(205): TemplateParser->getTemplate(string)
#1 mediawiki/extensions/MobileFrontend/includes/skins/MinervaTemplateAlpha.php(108): TemplateParser->processTemplate(string, array)
#2 mediawiki/extensions/MobileFrontend/includes/skins/MinervaTemplateAlpha.php(123): MinervaTemplateAlpha->makeChromeHeaderContent(array)
#3 mediawiki/extensions/MobileFrontend/includes/skins/MinervaTemplateAlpha.php(151): MinervaTemplateAlpha->renderHeader(array)
#4 mediawiki/extensions/MobileFrontend/includes/skins/MinervaTemplate.php(74): MinervaTemplateAlpha->render(array)
#5 mediawiki/includes/skins/SkinTemplate.php(232): MinervaTemplate->execute()
#6 mediawiki/extensions/MobileFrontend/includes/skins/SkinMinerva.php(1017): SkinTemplate->outputPage()
#7 mediawiki/extensions/MobileFrontend/includes/skins/SkinMinervaBeta.php(47): SkinMinerva->outputPage(OutputPage)
#8 mediawiki/includes/OutputPage.php(2285): SkinMinervaBeta->outputPage()
#9 mediawiki/includes/MediaWiki.php(581): OutputPage->output()
#10 mediawiki/includes/MediaWiki.php(422): MediaWiki->main()
#11 mediawiki/index.php(46): MediaWiki->run()
#12 {main}

Adding a echo $code; die; into TemplateParser.php to debug it (and clearing cache again), makes it yield the following:

				<br />
<b>Parse error</b>:  syntax error, unexpected 'return' (T_RETURN) in <b>/Users/krinkle/Development/mediawiki/core/includes/TemplateParser.php(136) : eval()'d code</b> on line <b>1</b><br />
b0c12de1faa0bf775b9d3180b4aafe29230846f824b4eca745a96f70052b6915 return function ($in, $debugopt = 1) {
    $cx = array(
        'flags' => array(
            'jstrue' => false,
            'jsobj' => false,
            'spvar' => false,
            'prop' => false,
            'method' => false,
            'mustlok' => false,
            'mustsec' => false,
            'echo' => false,
            'debug' => $debugopt,
        ),
        'constants' => array(),
        'helpers' => array(),
        'blockhelpers' => array(),
        'hbhelpers' => array(),
        'partials' => array(),
        'scopes' => array($in),
        'sp_vars' => array('root' => $in),

    );
    
    return '<a class="'.htmlentities((string)((isset($in['mobileMenuClass']) && is_array($in)) ? $in['mobileMenuClass'] : null), ENT_QUOTES, 'UTF-8').'" href="'.htmlentities((string)((isset($in['mobileMenuLink']) && is_array($in)) ? $in['mobileMenuLink'] : null), ENT_QUOTES, 'UTF-8').'">'.htmlentities((string)((isset($in['mobileMenuTitle']) && is_array($in)) ? $in['mobileMenuTitle'] : null), ENT_QUOTES, 'UTF-8').'</a>
'.LCRun3::sec($cx, ((isset($in['showSearchForm']) && is_array($in)) ? $in['showSearchForm'] : null), $in, false, function($cx, $in) {return '
'.((isset($in['searchForm']) && is_array($in)) ? $in['searchForm'] : null).'
';}).'
'.LCRun3::sec($cx, ((isset($in['showTitle']) && is_array($in)) ? $in['showTitle'] : null), $in, false, function($cx, $in) {return '
<div class="header-title">
	<a href="'.htmlentities((string)((isset($in['mobileMenuLink']) && is_array($in)) ? $in['mobileMenuLink'] : null), ENT_QUOTES, 'UTF-8').'">'.((isset($in['siteName']) && is_array($in)) ? $in['siteName'] : null).'</a>
</div>
';}).'
';
}
?><br />

So from what I can tell, at least this first fatal error, isn't related to Jenkins or MobileFrontend but a bug in the TemplateParser code and MF is just one first or only extension to make use of it.

Krinkle set Security to None.
Krinkle edited subscribers, added: kaldari; removed: gerritbot.

Change 198658 had a related patch set uploaded (by Krinkle):
Add breaking tests for fatal error in TemplatParser

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

Change 198658 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

Change 198671 had a related patch set uploaded (by Alex Monk):
TemplateParser: Don't fatal on cache misses

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

Change 198671 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

Change 198672 had a related patch set uploaded (by Alex Monk):
TemplateParser: Don't fatal on cache misses

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

Change 198672 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

Change 198655 merged by jenkins-bot:
Migrate mobile-qunit jobs to new CI slaves in labs

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

Could this failure in ContentTranslation also be related? - https://gerrit.wikimedia.org/r/#/c/198187/

T93594 is causing MobileFrontend qunit-mobile job to fail still.