Search code examples
laravelqueuedaemonlumensupervisord

Supervisorctl does not auto-restart daemon queue worker when hanging


I have supervisorctl managing some daemon queue workers with this configuration :

[program:jobdownloader]
process_name=%(program_name)s_%(process_num)03d
command=php /var/www/microservices/ppsatoms/artisan queue:work ppsjobdownloader --daemon --sleep=0
autostart=true
autorestart=true
user=root
numprocs=50
redirect_stderr=true
stdout_logfile=/mnt/@@sync/jobdownloader.log

Sometimes some workers are like hanging (running but stop getting queue messages) and supervisorctl does not automatically restart them, so I have to monitor and manually restart them.

Is there something wrong with the configuration? What can I do to prevent this to happen in the future?


Solution

  • Update :

    Run the process as normal process (non-daemon) so that supervisorctl can restart the workers after they signal exit code :

    [program:jobdownloader]
    process_name=%(program_name)s_%(process_num)03d
    command=php /var/www/microservices/ppsatoms/artisan queue:work ppsjobdownloader --sleep=0
    autostart=true
    autorestart=true
    user=root
    numprocs=50
    redirect_stderr=true
    stdout_logfile=/mnt/@@sync/jobdownloader.log