XF 2.1 Occasional ParseErrors

Brettflan

Active member
Occasionally on our staging forum, possibly related to installing / disabling / enabling addons or changing other settings in the admin panel, we'll suddenly be getting yellow ParseError notices at the top of each page, with pages of course lacking any CSS styling and looking generally messed up.

ParseError example from one page:
Code:
 * public:lightslider.less: ParseError: Unexpected input in public:lightslider.less on line 11, column 1 (on or near line 11)
  8 | @block-noStripSel: ~.block-container:not(.block-container--noStripRadius);
  9 |
  10 | // HELPERS
*11*| @zIndex-1: 1 * ();
  12 | @zIndex-2: 2 * ();
  13 | @zIndex-3: 3 * ();
  14 | @zIndex-4: 4 * ();

* public:node_list.less: ParseError: Unexpected input in public:node_list.less on line 11, column 1 (on or near line 11)
  8 | @block-noStripSel: ~.block-container:not(.block-container--noStripRadius);
  9 |
  10 | // HELPERS
*11*| @zIndex-1: 1 * ();
  12 | @zIndex-2: 2 * ();
  13 | @zIndex-3: 3 * ();
  14 | @zIndex-4: 4 * ();

* public:notices.less: ParseError: Unexpected input in public:notices.less on line 11, column 1 (on or near line 11)
  8 | @block-noStripSel: ~.block-container:not(.block-container--noStripRadius);
  9 |
  10 | // HELPERS
*11*| @zIndex-1: 1 * ();
  12 | @zIndex-2: 2 * ();
  13 | @zIndex-3: 3 * ();
  14 | @zIndex-4: 4 * ();

* public:share_controls.less: ParseError: Unexpected input in public:share_controls.less on line 11, column 1 (on or near line 11)
  8 | @block-noStripSel: ~.block-container:not(.block-container--noStripRadius);
  9 |
  10 | // HELPERS
*11*| @zIndex-1: 1 * ();
  12 | @zIndex-2: 2 * ();
  13 | @zIndex-3: 3 * ();
  14 | @zIndex-4: 4 * ();

* public:extra.less: ParseError: Unexpected input in public:extra.less on line 11, column 1 (on or near line 11)
  8 | @block-noStripSel: ~.block-container:not(.block-container--noStripRadius);
  9 |
  10 | // HELPERS
*11*| @zIndex-1: 1 * ();
  12 | @zIndex-2: 2 * ();
  13 | @zIndex-3: 3 * ();
  14 | @zIndex-4: 4 * ();

And here is one of the errors logged with stack trace:
Code:
    XF\CssRenderException: Error rendering template public:extra.less: ParseError: Unexpected input in public:extra.less on line 11, column 1 (on or near line 11) src/XF/CssRenderException.php:87

    Generated by: Unknown account May 23, 2019 at 5:50 PM

Stack trace

8 | @block-noStripSel: ~'.block-container:not(.block-container--noStripRadius)';
9 |
10 | // HELPERS
*11*| @zIndex-1: 1 * ();
12 | @zIndex-2: 2 * ();
13 | @zIndex-3: 3 * ();
14 | @zIndex-4: 4 * ();
------------

#0 src/XF/CssRenderer.php(408): XF\CssRenderException::createFromLessException(Object(Less_Exception_Chunk), 'public:extra.le...', '// Note that th...')
#1 src/XF/CssRenderer.php(342): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#2 src/XF/CssRenderer.php(250): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#3 src/XF/CssRenderer.php(116): XF\CssRenderer->renderTemplates(Array, Array, Array)
#4 src/XF/CssWriter.php(53): XF\CssRenderer->render(Array)
#5 css.php(30): XF\CssWriter->run(Array, 0, 1, '7601f4620b42efd...')
#6 {main}

-------------

Previous Less_Exception_Chunk: ParseError: Unexpected input in anonymous-file-0.less on line 11, column 1
09|
10| // HELPERS
11| @zIndex-1: 1 * ();
12| @zIndex-2: 2 * ();
13| @zIndex-3: 3 * ();
14| @zIndex-4: 4 * (); - src/vendor/oyejorge/less.php/lib/Less/Parser.php:677
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#2 src/XF/CssRenderer.php(404): Less_Parser->parse('// Note that th...')
#3 src/XF/CssRenderer.php(342): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#4 src/XF/CssRenderer.php(250): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#5 src/XF/CssRenderer.php(116): XF\CssRenderer->renderTemplates(Array, Array, Array)
#6 src/XF/CssWriter.php(53): XF\CssRenderer->render(Array)
#7 css.php(30): XF\CssWriter->run(Array, 0, 1, '7601f4620b42efd...')
#8 {main}

Request state

array(4) {
  ["url"] => string(106) "/test-site/css.php?css=public%3Aextra.less&s=0&l=1&d=1558650574&k=7601f4620b42efdd0314fded41acc02c151d589c"
  ["referrer"] => string(68) "https://<our_forum_domain>/test-site/admin.php?templates/outdated"
  ["_GET"] => array(5) {
    ["css"] => string(17) "public:extra.less"
    ["s"] => string(1) "0"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1558650574"
    ["k"] => string(40) "7601f4620b42efdd0314fded41acc02c151d589c"
  }
  ["_POST"] => array(0) {
  }
}

It seemed that running "rebuild master data" sometimes cleared it up, though that might be circumstantial. Sometimes it also doesn't fix the problem.

I also looked into the .less file which was triggering the error, and found that the line triggering the error is in setup.less and refers to "@xf-zIndexMultiplier" in the parentheses, which I'm guessing is returning null or '', resulting in that parse error. I even checked the style properties and found the indicated Z-index multiplier value under the Miscellaneous section, but that was correctly set to 100 in each theme, and changing it while the parse errors were happening made no difference. So, I'm not sure how that value is apparently returning nothing when that setup.less file is being parsed. Or, for that matter, why the setup.less file's contents are being flagged when it'sapparently trying to parse other ".less" files.

I also haven't seen the problem happen on my VM test server which has the same set of addons and styles and mostly the same settings and other data, I've only seen it on the staging forum on our live server.

I'm running out of ideas here as to what might be causing the problem. Do you have any suggestions for other things I can look into, or ideas what might be causing any of that?

EDIT:
I should add that we currently have designer and development modes enabled while working on things. However, with these parse errors, I've tried disabling those, as well as disabling all addons, then running a "rebuild master data", without any of that currently fixing it. The parse errors of course disappeared with designer/dev modes disabled, but all pages were still without CSS styling and messed up.

EDIT 2:
OK, pretty sure I finally figured out the cause. It had gotten gradually worse and worse, popping back up, so bad that I eventually couldn't find any way to fix it. I was even digging into how XF handles its file cache.
Not sure why I didn't think of it before (mental blind spot I guess), but I finally noticed that I do indeed have APC caching enabled in config, via:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Apc';
Commenting those out to disable the APC caching support immediately cleared up the parse errors again.

Not sure what's going wrong with it yet, but APCu is reporting 78% unused (25 MB free out of 32 MB), so it's not for lack of free memory. I haven't had problems with APCu before with other software which uses it, either, so not sure why this is coming up now.
Probably past time I updated to newer PHP+addons releases anyway, that might help.
 
Last edited:
Top Bottom