bugsnag / bugsnag-laravel

BugSnag notifier for the Laravel PHP framework. Monitor and report Laravel errors.
https://docs.bugsnag.com/platforms/php/laravel/
MIT License
876 stars 129 forks source link

Add a bootstrapper to allow OOMs to be handled #430

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 a new OomBootstrapper which can be used to enable Bugsnag Laravel to capture OOMs. 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 Laravel

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

Design

The new OomBootstrapper has to be registered manually by the developer as the first bootstrapper in their HTTP kernel. This is because Laravel's shutdown function will crash before our code is called if we register a shutdown function after Laravel's

The bootstrapper doesn't depend on anything that's Laravel specific, so Lumen apps can also use it by manually calling bootstrap before creating the Lumen Application

Changeset

Testing