?
avatar mpavey0
mpavey0
26 Jul 2017

Steps to reproduce the issue

  1. Set up a Joomla! 3.7.4 website
  2. Make an HTTP request to a URL that does not exist, for example using the format /{sometext}/{moretext} (for example, /en/cgla-news)

Expected result

No uncaught exception errors generated by the application.

Actual result

System generates an uncaught exception of class JException.

Example, for /en/cgla-news:

JException: Uncaught exception 'JException' with message 'Category not found' in /var/www/vhosts/[hidden]/httpdocs/libraries/legacy/error/error.php:200
in JError::raise called at /var/www/vhosts/[hidden]/httpdocs/libraries/legacy/error/error.php (277)
in JError::raiseError called at /var/www/vhosts/[hidden]/httpdocs/libraries/legacy/view/categoryfeed.php (73)
in JViewCategoryfeed::display called at /var/www/vhosts/[hidden]/httpdocs/libraries/legacy/controller/legacy.php (671)
in JControllerLegacy::display called at /var/www/vhosts/[hidden]/httpdocs/components/com_content/controller.php (113)
in ContentController::display called at /var/www/vhosts/[hidden]/httpdocs/libraries/legacy/controller/legacy.php (709)
in JControllerLegacy::execute called at /var/www/vhosts/[hidden]/httpdocs/components/com_content/content.php (39)
in require_once called at /var/www/vhosts/[hidden]/httpdocs/libraries/cms/component/helper.php (389)
in JComponentHelper::executeComponent called at /var/www/vhosts/[hidden]/httpdocs/libraries/cms/component/helper.php (364)
in JComponentHelper::renderComponent called at /var/www/vhosts/[hidden]/httpdocs/libraries/cms/application/site.php (191)
in JApplicationSite::dispatch called at /var/www/vhosts/[hidden]/httpdocs/libraries/cms/application/site.php (230)
in JApplicationSite::doExecute called at /var/www/vhosts/[hidden]/httpdocs/libraries/cms/application/cms.php (265)
in JApplicationCms::execute called at /var/www/vhosts/[hidden]/httpdocs/index.php (49)

(Also attached — see below.)

System information (as much as possible)

OS: ‪CentOS Linux 7.3.1611 (Core)‬
PHP 7.1.6
MySQL-compatible DB
Joomla! 3.7.4
More details in the attached forum post assistant output.

Additional comments

(Originally posted on the Joomla! forum, but it seems better suited to be logged as an issue.)

I recently upgraded my company's website from Joomla! 2.5.28 to Joomla! 3.7.3 (and now 3.7.4). As part of this project, I migrated the Joomla! application to a new server, running PHP 7.1.6, and to ensure it keeps running well and I am alerted to any problems, I installed the New Relic monitoring software (APM) on the server.

The new site is up and running well. However, I'm seeing an average error rate of almost 17%. The majority of these errors are exceptions of class 'JException'. By far the most frequent one is associated with the transaction name '/ContentController/Display'.

Investigation revealed that most, if not all, of these requests are being triggered by calls to URLs which don't exist, such as /en/cgla-news (being requested by a user agent 'Go-http-client/1.1'), and /wp-login.php (being requested by a user agent 'Mozilla/5.0'). The web server correctly responds with a 404 error message page.

I don't consider there to be anything going wrong here, and don't want these events being recorded as errors (and thus triggering alerts that the percentage of requests erroring is abnormally high, and obscuring visibility into any more concerning errors that might happen). Is there anything I can do? Is this a bug, or PHP 7 incompatibility, with Joomla!? The stack traces appear to suggest it is not related to any non-core components I have installed.

I am attaching the output of the Forum Post Assistant, too.

Attachments

JException example stack trace.txt
Forum Post Assistant (PDF).pdf
Forum Post Assistant (PNG).png

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
2.00

avatar mpavey0 mpavey0 - open - 26 Jul 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Jul 2017
avatar mbabker
mbabker - comment - 26 Jul 2017

It's basically how the error handling system works. A 404 exception is thrown and caught by the registered exception handler to act on it. In the code, any call to JError::raiseError() basically converts to an Exception object (and JError internally uses JException).

I'd suggest trying to tune the New Relic settings as a starting point. Many PHP frameworks internally work with Exceptions in a similar way and I can't say I note too many 404 errors in my New Relic monitoring for those frameworks.

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Jul 2017
Status New Discussion
avatar mpavey0
mpavey0 - comment - 26 Jul 2017

Thanks @mbabker, that certainly makes sense. When you say:

A 404 exception is thrown and caught by the registered exception handler to act on it.

I assume (as a relative PHP novice) this means there are two types of catching: using a catch statement (generates no PHP error), and using a custom exception handler (generates a PHP error, but doesn't log the error or halt code execution, and in this case generates a 404 response). Is that right?

I guess I was assuming that New Relic would be intelligent enough not to flag something that is not an error as an error, or alternatively that there would be a way to code Joomla!'s category name lookups (etc.) with catch statements.

But failing that, certainly it seems that configuring New Relic to ignore these 'errors' would be a good solution! Is it safe to ignore all JExceptions, or do I need to be more nuanced than that?

avatar rossfeldman
rossfeldman - comment - 19 Aug 2017

We've been dealing with the same issue. Did you ever manage to tune NewRelic, or implement a different solution?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17290.

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Aug 2017
Status Discussion Information Required
avatar brianteeman brianteeman - change - 20 Aug 2017
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2017-08-20 10:09:45
Closed_By brianteeman
avatar brianteeman brianteeman - close - 20 Aug 2017
avatar brianteeman
brianteeman - comment - 20 Aug 2017

I am going to close this as the expected behaviour as described my @mbabker

avatar rossfeldman
rossfeldman - comment - 20 Aug 2017

@mpavey0 I'd love to know if you made any progress on this from the NewReiic side of things.

avatar mpavey0
mpavey0 - comment - 21 Aug 2017

Hi @rossfeldman . Glad to hear I'm not the only one who has been struggling with this :)

Yes, I did make some progress. It's captured in the Joomla! forum thread I linked to above, but here's one relevant excerpt:

After a little digging, I was able to fine-tune New Relic to ignore JException exceptions. (In case it helps anyone, the settings are outlined here, and specifically, what you need to do is add JException to the newrelic.error_collector.ignore_exceptions setting in the newrelic.ini file.)

Ignoring all JException exceptions is a bit of a blunt tool, and @mbabker goes into some more of the detail in that thread. As far as I can see New Relic has no mechanism for fine-tuning based on HTTP response codes, unfortunately. So far I have opted to ignore all JException exceptions (at the cost of some false positives) but not, for instance, Exception exceptions (generated, for example, by /libraries/legacy/controller/legacy.php for certain URIs that result in this error message being logged and a 404 response: Uncaught exception 'Exception' with message 'View not found [name, type, prefix]: remind, html, contentView').

Add a Comment

Login with GitHub to post a comment