I’m using Laravel Horizon which has a Failed Jobs section which used to work fine. Until I added the Sentry notification for failed jobs, in Job’s Class.
/**
* Handle a job failure.
*
* @return void
*/
public function failed(Exception $exception)
{
if ( app()->bound('sentry') ) {
app('sentry')->captureException($exception);
}
}
Now, when visiting the Failed Jobs tab in Horizon – it results in fatal error with memory exceeded. How can I make both Horizon and this sentry notification work?
2
Answers
You can start and increasing memory, following the "How to increase the PHP memory_limit for better performance?" article from Vaishnavi Parameswaran.
But check also if the memory limitation actually comes from the OS instead of PHP, as explained here.
The 2018
laravel/horizon
issues 375 also referencedlaravel/horizon/src/Listeners/MonitorMasterSupervisorMemory.php
as a possible cause.So double-check your
laravel/horizon/config/horizon.php
setting.As in
laravel/horizon
issue 748, check your sentry.io errors for a line similar to:Again, you will see a
--memory
argument which could have an impact here.You can create command to clean up older records of
failed_jobs
table.