Browse Source

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
Ben Nemec 6 months ago
parent
commit
4fa30ae5d7
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      os_collect_config/collect.py

+ 3
- 0
os_collect_config/collect.py View File

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

Loading…
Cancel
Save