From cf2d08c7a5ed428c3db0c76379b4cf6a5b791055 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Fri, 28 Sep 2018 16:33:11 +0000 Subject: [PATCH] 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) --- os_collect_config/collect.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/os_collect_config/collect.py b/os_collect_config/collect.py index e9e4389..8fec7ad 100644 --- a/os_collect_config/collect.py +++ b/os_collect_config/collect.py @@ -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())