Skip to content

Commit d4f0e6c

Browse files
author
cod1k
committed
FIX: exception handling while spawning fcgi-program which address already bound to another process
1 parent 3285628 commit d4f0e6c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

supervisor/process.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,19 @@ def spawn(self):
739739
"""
740740
Overrides Subprocess.spawn() so we can hook in before it happens
741741
"""
742-
self.before_spawn()
742+
try:
743+
self.before_spawn()
744+
except NotImplementedError:
745+
raise
746+
except BaseException as e:
747+
if hasattr(self, 'group') and hasattr(self.group, 'socket_manager'):
748+
self.record_spawnerr('Could not create FastCGI socket %s: %s' % (
749+
self.group.socket_manager.config(), e))
750+
else:
751+
self.record_spawnerr(e.args[0])
752+
self.change_state(ProcessStates.BACKOFF)
753+
self.give_up()
754+
return
743755
pid = Subprocess.spawn(self)
744756
if pid is None:
745757
#Remove object reference to decrement the reference count on error

0 commit comments

Comments
 (0)