Skip to content

Error found with New Relic - please fix to make it quiet - _global_variables #5361

Description

@ttmwebdesign

Description of the problem
This is an error message that apparently is only popping up in New Relic. I don't know if it's impacting the site's performance at all, it may not be, but it's hard to tell as I've been chasing problems on this site for a while and want to make sure this is not part of it.

It's a frequent error in the distributed tracing of New Relic, and I would like it to be gone so I'm not checking the red errors only to see something that is a false alarm more or less?? I only want to see real problems, not a legacy fallback that is erroring needlessly.

How To Reproduce
Steps to reproduce the behavior:

  1. Open and edit GlobalVariable.php.
  2. Add this to the 'catch' in line 194 & save the file:

// Optional debug switch to surface swallowed filesystem exceptions on frontend.
if (defined('REQ') && REQ === 'PAGE' && isset(ee()->input) && ee()->input->get('gv_fs_debug') === '1') {
    throw $e;
}
  1. Run the front end URL with this to call the error message: ?gv_fs_debug=1
  2. You should see a stack trace similar to below.

Error Messages


ExpressionEngine\Library\Filesystem\FilesystemException Caught
Cannot get contents of path, the path is invalid: var/www/html/system/user/templates/_global_variables
ee/ExpressionEngine/Library/Filesystem/Filesystem.php:285

Stack Trace: Please include when reporting this error
#0 ee/ExpressionEngine/Model/Template/GlobalVariable.php(193): ExpressionEngine\Library\Filesystem\Filesystem->getDirectoryContents('var/www/html/sy...', true, true)
#1 ee/ExpressionEngine/Service/Template/Variables/StandardGlobals.php(43): ExpressionEngine\Model\Template\GlobalVariable->loadAll()
#2 ee/legacy/libraries/Template.php(3187): ExpressionEngine\Service\Template\Variables\StandardGlobals->getTemplateVariables()
#3 ee/legacy/libraries/Template.php(186): EE_Template->parse_globals('{!-- ra:0000000...')
#4 ee/legacy/libraries/Core.php(831): EE_Template->run_template_engine('', '')
#5 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#6 [internal function]: EE->index()
#7 ee/ExpressionEngine/Core/Core.php(269): call_user_func_array(Array, Array)
#8 ee/ExpressionEngine/Core/Core.php(125): ExpressionEngine\Core\Core->runController(Array)
#9 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#10 html/index.php(164): require_once('...')
#10 html/index.php(164): require_once('...')

Environment Details:

  • Version: [7.5.24]
  • PHP Version [8.1]
  • MySQL Version [8.0.46]
  • OS: [Linux]
  • Web Server: [nginx]

Possible Solution
CoPilot suggested adding this to just before the 'try' in the for loop, on line 192 of GlobalVariable.php:


if (! ee('Filesystem')->isDir($path)) {
      continue;
}

I tested it in conjunction with the debug code and the error was no longer generated, so it seems solid, but I don't know the reasoning behind the silent erroring in the rest of the loop, so hopefully someone can take a look at this and chime in as to why it's been left to only scream into the void rather than be squashed from the outset.

I get that legacy stuff needs to be accounted for, but the errors shouldn't be thrown for something like New Relic to pick up. It's a false alarm and is just getting in the way of me pinpointing any real issues with the site.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions