简体   繁体   中英

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM