sentry-php: Capturing E_ERROR fatal errors broken on PHP 7
What are you all doing to capture fatal PHP errors, such as allowed memory size exhausted? To capture this fatal error successfully, I had to comment out the
return FALSE;in shouldCaptureFatalError():if (PHP_VERSION_ID >= 70000 && $type === E_ERROR) { // return false; }sample code:
<?php include '../vendor/autoload.php'; $client = new Raven_Client('...'); $client->install(); while (TRUE) { $a[] = 11111111111; }
It seems like this does prevent those errors from being reporting, however removing that seems to bring us back to the original issue causing 2 reports for the same error, likely caused by https://github.com/getsentry/sentry-php/blob/25a2134ad9461e375baa22fe1e186796edab60a9/lib/Raven/ErrorHandler.php#L84 which causes the following error in my PHP 7.2 installation:
Parse error: syntax error, unexpected '}' in /private/var/www/sentry-php/error.php on line 5
Fatal error: Exception thrown without a stack frame in Unknown on line 0
Which are both reported, which is ofcourse incorrect.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 48 (11 by maintainers)
Commits related to this issue
- fixes #552 Capturing E_ERROR fatal errors broken on PHP 7 ignore Uncaught Error if exception handling is active; capture other errors — committed to mfb/sentry-php by mfb 6 years ago
- fixes #552 Capturing E_ERROR fatal errors broken on PHP 7 ignore "Uncaught" if exception handling is active; capture other errors — committed to mfb/sentry-php by mfb 6 years ago
- fixes #552 Capturing E_ERROR fatal errors broken on PHP 7 ignore "Uncaught" and "Exception thrown without a stack frame" if exception handling is active; capture other errors — committed to mfb/sentry-php by mfb 6 years ago
- Try to fix #552 allowing all fatals to be captured; add regression PHPT test — committed to getsentry/sentry-php by Jean85 6 years ago
- Try to fix #552 allowing all fatals to be captured; add regression PHPT test (#571) — committed to getsentry/sentry-php by Jean85 6 years ago
I’m currently experiencing a strange issue with this too: using the Symfony integration, when a fatal (like a type error) is thrown, the actual behavior of the client creates a loop that does capture the exception but not the fatal, which “continues” and re-captures it again as an exception, generating a loop and creating thousands of identical events.
For reasons that hours of debugging couldn’t explain yet,
FatalThrowableErrortriggers a runaway only when the NewRelic exception handler was installed by their extension first. Stack looks like (newer frame last)Is this the same issue?
(sentry/sentry 1.8.2, sentry/sentry-symfony 0.8.7)
It seems that https://github.com/symfony/symfony/pull/26568 fixes the issue, yay! 🎉
@Jean85 I’d like to throw in the fact that we’re not using the New Relic extension and are still experiencing many duplicate events being logged when encountering a
FatalErrorException. For example, on a production server that was missing some cache:This exception would be captured between 10-20 times in 1 second.
I’m currently not sure how this should be fixed. I need to find time to investigate this further, because I do not know the full extent of this problem.
It seems that the combination that triggers this issue is
Is this right?
@Jean85 I haven’t seen that on sentry-php alone. So should be a bug report on sentry-symfony?