Description
Problem Statement
When PHP hits the configured memory_limit
, a fatal error is thrown. The Laravel framework is configured to handle such fatal errors through register_shutdown_function()
and frees some memory to allow further processing of the error (about 32k as of https://github.com/laravel/framework/pull/42646/files). When that reserved memory is exceeded again, the process abruptly stops.
I found that this SDK sometimes fails to report out-of-memory errors, most likely due to excessive memory usage during reporting. In our application, errors such as Allowed memory size of x exceeded
make it to Sentry only some amount of times. Other times, the process just crashes abruptly with no indication as to what went wrong.
Solution Brainstorm
I suspect that the breadcrumbs and other information that is already stored in the SDK context leading up to the out-of-memory error influence how much memory is used to report the error. Perhaps the SDK can detect out-of-memory errors and somehow limit the amount of memory it consumes to be well under the