Slide 1
Most trusted JOB oriented professional program
DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2
DevOps to DevSecOps – Learn the evolution
DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2
Get certified in the new tech skill to rule the industry
Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2
Master the art of DevOps
Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2
Gain expertise and certified yourself
Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3
Learn and get certified
AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow
next arrow

[SOLVED] Laravel : Supervisor FATAL/BACKOFF Exited too quickly (process log may have details)

Spread the Knowledge

Problem

I’m trying to use Laravel queues with a supervisor but the service is not working properly.

My config /etc/supervisord.d/laravel-worker.conf is:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/my-project/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=root:root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/my-project/worker.log

When I try to restart all programs:
$ sudo supervisorctl restart all
$ laravel-worker:laravel-worker_00: ERROR (abnormal termination)
$ laravel-worker:laravel-worker_01: ERROR (abnormal termination)

When I try to check status:
$ sudo supervisorctl status
$ laravel-worker:laravel-worker_00: BACKOFF Exited too quickly (process log may have details)
$ laravel-worker:laravel-worker_00: BACKOFF Exited too quickly (process log may have details)

Solution

In my case, the supervisor was exiting very fast because it was finishing before the startsecs and since startsecs wasn’t defined, it uses the default which is 1.

Setting startsecs=0 fixed my issue.

you need to add startsecs = 0 to your laravel-worker config like so:
[program:laravel-worker]     
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/my-project/artisan queue:work --sleep=3 --tries=3
.....
startsecs = 0

startsecs is default to 1s, if the program does not stay up for 1s it will see the startup as a failure. Set it to 0 so the program needn’t stay running for any particular amount of time. You can check this GitHub issue for more info: https://github.com/Supervisor/supervisor/issues/212

It would be better if you run the queue worker in daemon mode, use the –daemon flag: command=/usr/bin/php /var/www/my-project/artisan queue:work database --daemon --sleep=3 --tries=3

After you change the config file, you may need to run supervisorctl reload to allow the changes to take effect.