0

I have the following configuration for a process to run continuously. Apparently, it works very fine but after few hours or sometimes few minutes, the process gets terminated.

Any kind of help is highly appreciated.

Supervisord Config:

[program:action_consumer]
process_name=%(program_name)s_%(process_num)02d
command = php /var/www/the_api/web/index.php actionCron
numprocs = 2
autostart=true
autorestart=true
user=console_api
redirect_stderr=true
stdout_logfile=/var/www/the_api/logs/action_consumer.log
RestartSec=3
Restart=3
WatchdogSec=3

OS Info:

Debian GNU/Linux 8 (jessie)

Log file: The log file contains the following error:

FATAL state, too many start retries too quickly

Important:

It is obvious that the process terminates too quickly, it is my requirement. I don't want to run the script in an infinite loop. Is setting startretries a valid solution?

5
  • Check logs in /var/www/the_api/logs/action_consumer.log file. You might get better idea. If you are not able to understand the logs, Please edit your question and post it in same.
    – Nitesh B.
    Commented Apr 3, 2018 at 10:15
  • The error log just contains the output i have printed on the script using echo. Nothing else. @Nitesh Commented Apr 6, 2018 at 7:29
  • If your service is getting terminated, logs must be getting generated somewhere. How about system logs ? Did you check the system logs ?
    – Nitesh B.
    Commented Apr 6, 2018 at 7:54
  • I managed to print supervisor.log and it contains this error: FATAL state, too many start retries too quickly Commented Apr 6, 2018 at 8:02
  • So as per your updated question, yes, you can use startretries option.
    – Nitesh B.
    Commented Apr 6, 2018 at 8:09

2 Answers 2

0

In case the time frame for the race condition was less than a second so setting startretries=<number you want>. However you can set it to a much higher value if need be. Below is an example.

[program:test]
startretries=10
3
  • So supervisord will try to restart the script 10 times in a second? Can you explain this? Commented Apr 6, 2018 at 8:15
  • No, not 10 times in a second. The number explains that supervisord will attempting to start the program before giving up and putting the process into an FATAL state. you can find more example "supervisord.org/…"
    – Nitesh B.
    Commented Apr 6, 2018 at 9:44
  • How can be the startretries unlimited? Commented Apr 9, 2018 at 14:39
0

Since the issue was of 0 second execution time. Most of the time the scripts executes within 0 seconds, so supervisor terminates it. I resolved this issue by adding startsecs=0.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .