summaryrefslogtreecommitdiff
path: root/buildscripts/setup_multiversion_mongodb.py
diff options
context:
space:
mode:
authormike o'brien <mpobrien005@gmail.com>2015-04-29 08:38:43 -0400
committerErnie Hershey <ernie.hershey@10gen.com>2015-04-29 13:07:24 -0400
commitb4bab9ebc15f2b982e38fdd39f6920384fffa290 (patch)
tree1b7cf734ef66a78f80855dc7c5e6845deb9ab5ca /buildscripts/setup_multiversion_mongodb.py
parentda31be34dc6664d76868543e9ccdaecad4f504c6 (diff)
downloadmongo-b4bab9ebc15f2b982e38fdd39f6920384fffa290.tar.gz
SERVER-18251 multiversion setup script should dump stacks on SIGUSR1 signal
Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
Diffstat (limited to 'buildscripts/setup_multiversion_mongodb.py')
-rw-r--r--buildscripts/setup_multiversion_mongodb.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/buildscripts/setup_multiversion_mongodb.py b/buildscripts/setup_multiversion_mongodb.py
index dcf65f77a76..9ba9fbf4983 100644
--- a/buildscripts/setup_multiversion_mongodb.py
+++ b/buildscripts/setup_multiversion_mongodb.py
@@ -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: