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:
parent
da31be34dc
commit
b4bab9ebc1
@ -7,6 +7,9 @@ import tempfile
|
|||||||
import urllib2
|
import urllib2
|
||||||
import subprocess
|
import subprocess
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import signal
|
||||||
|
import threading
|
||||||
|
import traceback
|
||||||
import shutil
|
import shutil
|
||||||
import errno
|
import errno
|
||||||
# To ensure it exists on the system
|
# To ensure it exists on the system
|
||||||
@ -17,6 +20,20 @@ import gzip
|
|||||||
# Only really tested/works on Linux.
|
# 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):
|
def version_tuple(version):
|
||||||
"""Returns a version tuple that can be used for numeric sorting
|
"""Returns a version tuple that can be used for numeric sorting
|
||||||
of version strings such as '2.6.0-rc1' and '2.4.0'"""
|
of version strings such as '2.6.0-rc1' and '2.4.0'"""
|
||||||
@ -215,6 +232,12 @@ def parse_cl_args(args):
|
|||||||
|
|
||||||
def main():
|
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:])
|
downloader, versions = parse_cl_args(sys.argv[1:])
|
||||||
|
|
||||||
for version in versions:
|
for version in versions:
|
||||||
|
Loading…
Reference in New Issue
Block a user