bugsnag / bugsnag-symfony

BugSnag notifier for the Symfony PHP framework. Monitor and report errors in your Symfony apps.
https://docs.bugsnag.com/platforms/php/symfony
MIT License
43 stars 21 forks source link

Allow Bugsnag Symfony handle OOMs #119

Closed imjoehaines closed 3 years ago

imjoehaines commented 3 years ago

Waiting on https://github.com/bugsnag/bugsnag-php/pull/621 to be merged & released


Goal

This PR adds OOM handling to the BugsnagListener's onKernelException method. The implementation is essentially the same as https://github.com/bugsnag/bugsnag-php/pull/621, but has to use a slightly different mechanism as the Bugsnag\Handler class isn't used in Bugsnag Symfony

This can be used in conjunction with the new memory_limit_increase option (see https://github.com/bugsnag/bugsnag-php/pull/621) to give Bugsnag enough headroom to send OOMs

Note: the Symfony Debug component didn't call onKernelException for OOMs, but the newer ErrorHandler component does. This means the OOM handling won't take affect for Symfony versions below 4.4 (when ErrorHandler was added). I've added support for Symfony 2/3 OOM exceptions anyway, because there's no real overhead of doing so

Changeset

Testing