diff options
author | Daniel Hoffend <dh@dotlan.net> | 2019-11-18 12:02:54 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2019-11-18 12:02:54 +0100 |
commit | 6751e85733e746d58933e54cbf0acbfcc3ffd0d3 (patch) | |
tree | d1c4b94b0af7ff740ce29dcd884e79c9fbe18d95 /kolabd/__init__.py | |
parent | 17db4f8027ddbe1d887ebf0ebdc33ed46855d269 (diff) | |
download | pykolab-6751e85733e746d58933e54cbf0acbfcc3ffd0d3.tar.gz |
Fixes T5665: kolabd should now terminate its child processes on exit
Summary: This patch ensures that kolabd will terminate his forked childs
Test Plan: Tested on Debian 9 and Debian 10
Reviewers: #pykolab_developers, vanmeeuwen
Reviewed By: #pykolab_developers, vanmeeuwen
Differential Revision: https://git.kolab.org/D853
Diffstat (limited to 'kolabd/__init__.py')
-rw-r--r-- | kolabd/__init__.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kolabd/__init__.py b/kolabd/__init__.py index edeace2..98cd6ed 100644 --- a/kolabd/__init__.py +++ b/kolabd/__init__.py @@ -29,6 +29,7 @@ import shutil import sys import time import traceback +import multiprocessing import pykolab @@ -372,11 +373,15 @@ class KolabDaemon: at the same time, and therefore we need to test if the PID file exists, and only try/except removing it. """ - if os.access(conf.pidfile, os.R_OK): - try: + try: + for p in multiprocessing.active_children(): + p.terminate() + + if os.access(conf.pidfile, os.R_OK): os.remove(conf.pidfile) - except Exception: - pass + + except Exception: + pass raise SystemExit |