Don't ignore SIGPIPE

By default Python configures SIGPIPE to be SIG_IGN, which means to
ignore the signal. We don't want that as it causes problems when
journald restarts and our log calls start triggering SIGPIPEs.
Instead, we want to allow the SIGPIPE to kill the process so it can
be restarted by systemd.

Change-Id: I512139b96b2de8b372efc91e8a3fc8d33553405a
Closes-Bug: 1795030
(cherry picked from commit 4fa30ae5d7)
(cherry picked from commit f63f4d2dc8)
This commit is contained in:
Ben Nemec 2018-09-28 16:33:11 +00:00 committed by Ben Nemec
parent e7bf1c81ac
commit dd58c4b316
1 changed files with 3 additions and 0 deletions

View File

@ -241,6 +241,9 @@ def getfilehash(files):
def __main__(args=sys.argv, collector_kwargs_map=None):
signal.signal(signal.SIGHUP, reexec_self)
# NOTE(bnemec): We need to exit on SIGPIPEs so systemd can restart us.
# See lp 1795030
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
setup_conf()
CONF(args=args[1:], prog="os-collect-config",
version=version.version_info.version_string())