Laravel Queue worker dies after completing task

I have some troubles with laravel queue system. I use the following command to run my jobs:

php artisan queue:work --timeout=0 --queue=export > /dev/null 2>&1 & echo $!; 

Unfortunately, after completing each task this process kills itself. Laravel logs are clear, failed_jobs table is clear.

Thank you!

UPD:

I tried running job handler not in background

php artisan queue:work --timeout=0 --queue=export

The process finished after first job has been completed. No errors, just the process has finished. Job was completed successfully, but process died.

Laravel version is 8.76.2

I think the problem is in job class, because similar job handler on this site is working properly.


Solution 1:

Solved! The problem was in memory limit. After completing each task laravel queue worker checks if memory limit was exceed. If so - it just kills process - you can see it in Illuminate\Queue\Worker::daemon (stopIfNecessary function).

Solution is providing --memory flag when running job handler. The result code will be:

php artisan queue:work --memory=512 --timeout=0 --queue=export

Thanks everybody!