framework: supervised queue:listen stops working
I’m running the queue listen process via the following supervisor config (I’m using SQS).
[program:laravel-queue]
command=/usr/bin/php /var/www/server/current/artisan queue:listen --timeout 300 --tries=5 --env="production"
username=www-data
autostart=true
autorestart=true
stdout_logfile=/var/log/%(program_name)s.stdout
stderr_logfile=/var/log/%(program_name)s.stderr
Sometimes (~ every 5th day) the listen process “stops” and doesn’t consume any further tasks in the queue. The process doesn’t exit and thus won’t be restarted via supervisor. The stdout/stderr logfiles are empty.
When I restart the queue listen process via supervisorctl restart
all queued up processes get worked off.
Is there a best practice to monitor this behavior correctly until this issue gets resolved? I’ve written a little package to check for me if the queue is jammed, but it feels not very clean: https://github.com/schickling/laravel-queue-checker
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 3
- Comments: 38 (16 by maintainers)
A, ok. I see which part you do not understand.
So, the Laravel workers work like this:
expire
property that you have in your config file. if there are expired jobs, they release them. they do no check if some other worker died or it’s just processing for so long.The bolded text is the most important part, in that step the worker can select an already processing job, if it’s processing for to long, and they think that the first worker died and it just forget to release it. So the easy fix is to set
expire
to a bit more, like an hour or so.The second, better approach is the solution that I describe in previous comment.
I hope I made it a bit more clear for you now.
Just an FYI, mine was caused by using an incorrect php in command attribute in supervisord.conf file. I changed it from
php
to/usr/local/bin/php
and it fixed it.Are they making HTTP calls? If so make sure you set a max timeout in your HTTP client.
On Tue, Nov 17, 2015 at 3:01 AM, Matej Velikonja notifications@github.com wrote: