Skip to content

Commit

Permalink
allocate memory for error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
skylerfenn committed Jul 18, 2019
1 parent 1003c27 commit 8978729
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

class HandleExceptions
{
static $reservedMemory;

/**
* The application instance.
*
Expand All @@ -27,6 +29,8 @@ class HandleExceptions
*/
public function bootstrap(Application $app)
{
self::$reservedMemory = str_repeat('x', 10240);

This comment has been minimized.

Copy link
@adam1010

adam1010 Aug 12, 2020

Contributor

Line 32: This value isn't big enough to handle crashes that happen when large DB queries fail. I had to increase this value to 5 * 1024 * 1024 (5MB) on my server. Can we move this value to a config file so users can adjust it for their environment? @skylerfenn @taylorotwell

I've seen tickets on both Sentry and Snagabug repos where those libraries are unable to report the error because the reservedMemory here is too small to load them in. Using 5meg allows them to capture errors in many more situations.


$this->app = $app;

error_reporting(-1);
Expand Down Expand Up @@ -78,6 +82,7 @@ public function handleException($e)
}

try {
self::$reservedMemory = null;
$this->getExceptionHandler()->report($e);
} catch (Exception $e) {
//
Expand Down

0 comments on commit 8978729

Please sign in to comment.