Sentry-laravel: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40960 bytes)

Created on 16 Jan 2019  ·  10Comments  ·  Source: getsentry/sentry-laravel

Greetings,

I am having a problem with sentry laravel when I start my queue with php artisan queue:work I get the following error.

I am using the default config, and have set up the DSN in the .env file

D:\karugi>php artisan queue:work
[2019-01-16 18:34:13][554] Processing: App\Notifications\AdminNewAssessmentRequestedNotification
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 40960 bytes) in D:\karugi\vendor\sentry\sentry-laravel\src\Sentry\Laravel\EventHandler.php on line 102
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in D:\karugi\vendor\symfony\debug\Exception\FatalErrorException.php on line 1

Seems like this is the culprit inSentry\Laravel\EventHandler from line 99

/**
 * Pass through the event and capture any errors.
 *
 * @param string $method
 * @param array  $arguments
 */
public function __call($method, $arguments)
{
    try {
--->        call_user_func_array(array($this, $method . 'handler'), $arguments);
    } catch (Exception $exception) {
        // Ignore
    }
}

Don't really have a clue what's happening... If you need more info

Most helpful comment

Thanks I think we found it: #180

Working on finding the best way to clear the breadcrumbs, will be fixed soon 👍

All 10 comments

I am also experiencing this issue. This is making sentry unusable on the project.

This is happening after creating a new Guzzle client at the beginning of the job.
$client = new GuzzleHttp\Client();

I am also using the default Laravel sentry config.

Steps to reproduce:

  1. $ laravel new sentry-debug
  2. $ composer require sentry/sentry-laravel:1.0.0-beta2 php-http/curl-client guzzlehttp/psr7

Add Sentry reporting to App/Exceptions/Handler.php:

public function report(Exception $exception)
{
    if (app()->bound('sentry') && $this->shouldReport($exception)){
        app('sentry')->captureException($exception);
    }

    parent::report($exception);
}

Create the Sentry configuration file (config/sentry.php) with this command:

$ php artisan vendor:publish --provider="Sentry\Laravel\ServiceProvider"

  1. Add to .env

SENTRY_LARAVEL_DSN=

  1. $ php artisan make:job SentryGuzzleTest

  2. Install guzzle $ composer require guzzlehttp/guzzle:~6.0

  3. Add the following code to the handler() method in the job

$client = new \GuzzleHttp\Client();

  1. $ php artisan queue:work

  2. In a second terminal

$ php artisan tinker  
$job = new SentryGuzzleTest();  
$job->dispatch();  

Are @gkarugi & @puremana also on 1.0.0beta2 or on 0.11.x?

Ah sorry, looking at the original commit for those handlers something wen't wrong when migrating to the 2.x SDK.

https://github.com/getsentry/sentry-laravel/commit/6fdeaa068574c6202b44692181bb52e74b4bfc5e

The handler is supposed to be there and clear the breadcrumbs and sent all events.

We will dig into it!

Yes, I am on 1.0.0-beta2

On Fri, Jan 18, 2019, 11:51 AM Alex Bouma <[email protected] wrote:

Ah sorry, looking at the original commit for those handlers something
wen't wrong when migrating to the 2.x SDK.

6fdeaa0
https://github.com/getsentry/sentry-laravel/commit/6fdeaa068574c6202b44692181bb52e74b4bfc5e

The handler is supposed to be there and clear the breadcrumbs and sent all
events.

We will dig into it!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/getsentry/sentry-laravel/issues/178#issuecomment-455471381,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARD5G9i2Q3AKp7Mb2HTTLs52IKdQSO_vks5vEYsdgaJpZM4aDtH-
.

Both 1.0.0-beta1 and 1.0.0-beta2 caused the error for me

Thanks I think we found it: #180

Working on finding the best way to clear the breadcrumbs, will be fixed soon 👍

Any update for this issue?

@vincentkedison it was fixed a few days ago. Do make sure you are on beta3.

composer require sentry/sentry-laravel:1.0.0-beta3 php-http/curl-client guzzlehttp/psr7

Confirmed this fixed it for me as well. Was coming from beta2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IMM9O picture IMM9O  ·  5Comments

borealsmith picture borealsmith  ·  6Comments

andrey-helldar picture andrey-helldar  ·  7Comments

joveice picture joveice  ·  8Comments

carlosrgzm picture carlosrgzm  ·  7Comments