aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sosreport14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sosreport b/src/sosreport
index 711475f1..278d1d00 100755
--- a/src/sosreport
+++ b/src/sosreport
@@ -35,19 +35,27 @@ from snack import *
from threading import Thread, activeCount, enumerate
import signal
+__breakHits__ = 0 # Use this to track how many times we enter the exit routine
## Set up routines to be linked to signals for termination handling
def exittermhandler(signum, frame):
doExitCode()
def doExitCode():
- if activeCount() > 1:
+ global __breakHits__
+ __breakHits__ += 1
+ if ( ( activeCount() > 1 ) and ( __breakHits__ == 1 ) ):
print "SIGTERM received, multiple threads detected, waiting for all threads to exit"
for thread in enumerate():
thread.wait()
print "All threads ended, cleaning up."
- else:
- print "SIGTERM received, cleaning up"
+ if ( ( activeCount() > 1 ) and ( __breakHits__ > 1 ) ):
+ print "Multiple SIGTERMs, multiple threads, attempting to signal threads to die immediately"
+ ## FIXME: Add thread-kill code (see FIXME below)
+ print "Threads dead, cleaning up.
+ if ( ( activeCount() == 1 ) and ( __breakHits__ > 2 ) ):
+ print "Multiple SIGTERMs, single thread, exiting without cleaning up.
+ sys.exit(3)
# FIXME: Add code here to clean up /tmp
sys.exit(255)