Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

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

Problem

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

<strong>My config /etc/supervisord.d/laravel-worker.conf is:</strong>
[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.logCode language: PHP (php)

<strong>When I try to restart all programs:</strong>
$ sudo supervisorctl restart all
$ laravel-worker:laravel-worker_00: ERROR (abnormal termination)
$ laravel-worker:laravel-worker_01: ERROR (abnormal termination)Code language: HTML, XML (xml)

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.

<strong>you need to add startsecs = 0 to your laravel-worker config like so:</strong>
[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 = 0Code language: HTML, XML (xml)

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.

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.