From d4f0e6cf4cf7e82315912c3e244d13e0cbd4305e Mon Sep 17 00:00:00 2001 From: cod1k Date: Fri, 27 Jan 2023 18:36:09 +0200 Subject: [PATCH] FIX: exception handling while spawning fcgi-program which address already bound to another process --- supervisor/process.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/supervisor/process.py b/supervisor/process.py index b394be812..10d353947 100644 --- a/supervisor/process.py +++ b/supervisor/process.py @@ -739,7 +739,19 @@ def spawn(self): """ Overrides Subprocess.spawn() so we can hook in before it happens """ - self.before_spawn() + try: + self.before_spawn() + except NotImplementedError: + raise + except BaseException as e: + if hasattr(self, 'group') and hasattr(self.group, 'socket_manager'): + self.record_spawnerr('Could not create FastCGI socket %s: %s' % ( + self.group.socket_manager.config(), e)) + else: + self.record_spawnerr(e.args[0]) + self.change_state(ProcessStates.BACKOFF) + self.give_up() + return pid = Subprocess.spawn(self) if pid is None: #Remove object reference to decrement the reference count on error