Skip to content

Commit

Permalink
FIX: Supervisord crushes on exceptions while adding process-group
Browse files Browse the repository at this point in the history
  • Loading branch information
cod1k committed Jan 27, 2023
1 parent 896fe7c commit d736d0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions supervisor/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ def payload(self):
class ProcessGroupAddedEvent(ProcessGroupEvent):
pass

class AddProcessGroupFailedEvent(ProcessGroupEvent):
def __init__(self, group, err = None):
super().__init__(group)
self.err = err

def payload(self):
payload = super().payload()
return payload+'error:%s\n' % self.err

class ProcessGroupRemovedEvent(ProcessGroupEvent):
pass

Expand Down
7 changes: 6 additions & 1 deletion supervisor/supervisord.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ def add_process_group(self, config):
name = config.name
if name not in self.process_groups:
config.after_setuid()
self.process_groups[name] = config.make_group()
try:
self.process_groups[name] = config.make_group()
except BaseException as why:
self.options.logger.warn('Unable to add group %s: %s' % (name, why))
events.notify(events.AddProcessGroupFailedEvent(name, why))
return False
events.notify(events.ProcessGroupAddedEvent(name))
return True
return False
Expand Down

0 comments on commit d736d0b

Please sign in to comment.