Attempt to fix dispatcher crash on restart (#12257)

This commit is contained in:
Tony Murray
2020-10-24 21:13:59 -05:00
committed by GitHub
parent 8ab1c22de6
commit d314f6429a

View File

@ -225,7 +225,7 @@ class ServiceConfig:
def _get_config_data(self):
try:
import dotenv
env_path = "{}/.env".format(self.BASE_DIR)
env_path = "{}/.env".format(self.BASE_DIR)
info("Attempting to load .env from '%s'", env_path)
dotenv.load_dotenv(dotenv_path=env_path, verbose=True)
@ -314,7 +314,7 @@ class Service:
# Speed things up by only looking at direct zombie children
for p in psutil.Process().children(recursive=False):
try:
cmd = p.cmdline() # cmdline is uncached, so needs to go here to avoid NoSuchProcess
cmd = p.cmdline() # cmdline is uncached, so needs to go here to avoid NoSuchProcess
status = p.status()
if status == psutil.STATUS_ZOMBIE:
@ -529,7 +529,7 @@ class Service:
return
info('Restarting service... ')
if 'psutil' not in sys.modules:
warning("psutil is not available, polling gap possible")
self._stop_managers_and_wait()
@ -547,7 +547,8 @@ class Service:
:param signalnum: UNIX signal number
:param flag: Flags accompanying signal
"""
if (signal(SIGCHLD, SIG_DFL) == SIG_DFL):
handler = signal(SIGCHLD, SIG_DFL)
if handler == SIG_DFL:
# signal is already being handled, bail out as this handler is not reentrant - the kernel will re-raise the signal later
return