From c9e1e3d6653b88fbf1558505b29da5006367afdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Si=C3=B1uela=20Pastor?= Date: Mon, 16 Oct 2017 09:44:27 +0200 Subject: [PATCH] Remove signal handlers The signal handlers were introduced to avoid cache corruption when the clcache process is stopped in the middle of a write to the cache (statistics, manifests or objects). See #233. Even if SIGINT and SIGTERM were ignored the cache still had a chance to be corrupted in the event of a SIGTERM (which cannot be ignored). Since #233 the writing of files to the cache has been improved to replace the files atomically, reducing the risk of storing corrupted files in the cache. See pull requests #286, #292 and #296. Therefore ignoring these signals is not needed anymore. --- clcache/__main__.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/clcache/__main__.py b/clcache/__main__.py index 31bd130d..172bfba6 100644 --- a/clcache/__main__.py +++ b/clcache/__main__.py @@ -20,7 +20,6 @@ import os import pickle import re -import signal import subprocess import sys import threading @@ -1513,15 +1512,7 @@ def createManifestEntry(manifestHash, includePaths): return ManifestEntry(safeIncludes, includesContentHash, cachekey) -def installSignalHandlers(): - # Ignore Ctrl-C and SIGTERM signals to avoid corrupting the cache - signal.signal(signal.SIGINT, signal.SIG_IGN) - signal.signal(signal.SIGTERM, signal.SIG_IGN) - def main(): - - installSignalHandlers() - if len(sys.argv) == 2 and sys.argv[1] == "--help": print(""" clcache.py v{}