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 4fa30ae5d766c99ad27f74911b0456d06c474df3)
This commit is contained in:
Ben Nemec 2018-09-28 16:33:11 +00:00 committed by Emilien Macchi
parent d7c1fb7ed7
commit 43f5a5daec

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())