Why Are My Laravel Queue Jobs Failing After 60 Seconds?
I'm using Laravel Queues to process large numbers of media files, an individual job is expected to take minutes (lets just say up to an hour).
I am using Supervisor to run my queue, and I am running 20 processes at a time. My supervisor config file looks like this:
[program:duplitron-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/duplitron/artisan queue:listen database --timeout=0 --memory=500 --tries=1 autostart=true autorestart=true user=duplitron numprocs=20 redirect_stderr=true stdout_logfile=/var/www/duplitron/storage/logs/duplitron-worker.log
There are a few oddities that I don't know how to explain or correct:
- My jobs fairly consistently fail after running for 60 to 65 seconds.
- After being marked as failed the job continues to run even after being marked as failed. Eventually they do end up resolving successfully.
- When I run the failed task in isolation to find the cause of the issue it succeeds just fine.
I strongly believe this is a timeout issue; however, I was under the impression that
--timeout=0 would result in an unlimited timeout.
How can I prevent this temporary "failure" job state? Are there other places where a queue timeout might be invoked that I'm not aware of?
It turns out that in addition to timeout there is an
expire setting defined in
'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'expire' => 60, ],
Changing that to a higher value did the trick.
UPDATE: This parameter is now called
'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'retry_after' => 60, ],
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?