Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,8 @@ where specified.

The number of serial failure attempts that :program:`supervisord`
will allow when attempting to start the program before giving up and
putting the process into an ``FATAL`` state.
putting the process into an ``FATAL`` state. If set to ``-1`` it will
retry forever without increasing the delay between retries.

.. note::

Expand Down
3 changes: 2 additions & 1 deletion docs/subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ automatically restarted by :program:`supervisord`. It will switch
between ``STARTING`` and ``BACKOFF`` states until it becomes evident
that it cannot be started because the number of ``startretries`` has
exceeded the maximum, at which point it will transition to the
``FATAL`` state.
``FATAL`` state. If ``startretries`` is set to ``-1``, it will retry
indefinitely without reaching the ``FATAL`` state.

.. note::
Retries will take increasingly more time depending on the number of
Expand Down
23 changes: 16 additions & 7 deletions supervisor/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,10 @@ def transition(self):
# STOPPED -> STARTING
self.spawn()
elif state == ProcessStates.BACKOFF:
# immediate retry on startretries set to -1
if self.config.startretries == -1:
# BACKOFF -> STARTING
self.spawn()
if self.backoff <= self.config.startretries:
if now > self.delay:
# BACKOFF -> STARTING
Expand All @@ -698,13 +702,18 @@ def transition(self):
logger.info('success: %s %s' % (processname, msg))

if state == ProcessStates.BACKOFF:
if self.backoff > self.config.startretries:
# BACKOFF -> FATAL if the proc has exceeded its number
# of retries
self.give_up()
msg = ('entered FATAL state, too many start retries too '
'quickly')
logger.info('gave up: %s %s' % (processname, msg))
# never give up if startretries set to -1 - otherwise
# check whether backoff exceeded the configured startretries.
if self.config.startretries == -1:
pass
else:
if self.backoff > self.config.startretries:
# BACKOFF -> FATAL if the proc has exceeded its number
# of retries
self.give_up()
msg = ('entered FATAL state, too many start retries too '
'quickly')
logger.info('gave up: %s %s' % (processname, msg))

elif state == ProcessStates.STOPPING:
time_left = self.delay - now
Expand Down