0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-28 07:59:02 +01:00

SERVER-18251 multiversion setup script should dump stacks on SIGUSR1 signal

Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
This commit is contained in:
mike o'brien 2015-04-29 08:38:43 -04:00 committed by Ernie Hershey
parent da31be34dc
commit b4bab9ebc1

View File

@ -7,6 +7,9 @@ import tempfile
import urllib2
import subprocess
import tarfile
import signal
import threading
import traceback
import shutil
import errno
# To ensure it exists on the system
@ -17,6 +20,20 @@ import gzip
# Only really tested/works on Linux.
#
def dump_stacks(signal, frame):
print "======================================"
print "DUMPING STACKS due to SIGUSR1 signal"
print "======================================"
threads = threading.enumerate();
print "Total Threads: " + str(len(threads))
for id, stack in sys._current_frames().items():
print "Thread %d" % (id)
print "".join(traceback.format_stack(stack))
print "======================================"
def version_tuple(version):
"""Returns a version tuple that can be used for numeric sorting
of version strings such as '2.6.0-rc1' and '2.4.0'"""
@ -215,6 +232,12 @@ def parse_cl_args(args):
def main():
# Listen for SIGUSR1 and dump stack if received.
try:
signal.signal(signal.SIGUSR1, dump_stacks)
except AttributeError:
print "Cannot catch signals on Windows"
downloader, versions = parse_cl_args(sys.argv[1:])
for version in versions: