diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2017-03-16 14:39:09 -0400 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2017-03-16 14:39:09 -0400 |
commit | 5fe822f53e4bb28e15af2541c0ca931fa05a0e20 (patch) | |
tree | 2a6645be6030f990bfd946afc14c65ae773ff68b /buildscripts/hang_analyzer.py | |
parent | 38a2af996ae67f3c65194ea38a2d6e3a64682839 (diff) | |
download | mongo-5fe822f53e4bb28e15af2541c0ca931fa05a0e20.tar.gz |
SERVER-27874 Display locks and generate digraph for threads using LockManager locks and/or pthread_mutexes
Diffstat (limited to 'buildscripts/hang_analyzer.py')
-rwxr-xr-x | buildscripts/hang_analyzer.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/buildscripts/hang_analyzer.py b/buildscripts/hang_analyzer.py index b1c049dcf74..ec2316082e4 100755 --- a/buildscripts/hang_analyzer.py +++ b/buildscripts/hang_analyzer.py @@ -301,8 +301,12 @@ class GDBDumper(object): root_logger.info("dir %s" % script_dir) gdb_dir = os.path.join(script_dir, "gdb") printers_script = os.path.join(gdb_dir, "mongo.py") + mongo_lock_script = os.path.join(gdb_dir, "mongo_lock.py") bt_command = "mongodb-uniqstack bt" + mongodb_show_locks = "mongodb-show-locks" + mongodb_deadlock = "mongodb-waitsfor-graph debugger_deadlock_%s_%d.gv" % \ + (process_name, pid) if sys.platform.startswith("sunos"): ''' On Solaris, currently calling mongo-uniqstack leads to an error: @@ -318,20 +322,29 @@ class GDBDumper(object): When the function is done executing, GDB will silently stop. ''' bt_command = "thread apply all bt" + mongodb_show_locks = "" + mongodb_deadlock = "" cmds = [ - "set pagination off", + "set interactive-mode off", + "set print thread-events off", # Python calls to gdb.parse_and_eval may cause threads + # to start and finish. This suppresses those messages + # from appearing in the return output. + "file %s" % process_name, # Solaris must load the process to read the symbols. "attach %d" % pid, "info sharedlibrary", "info threads", # Dump a simple list of commands to get the thread name "set python print-stack full", - "source " + printers_script, + "source %s" % printers_script, + "source %s" % mongo_lock_script, bt_command, dump_command, - "mongodb-analyze", + "mongodb-dump-locks", + mongodb_show_locks, + mongodb_deadlock, "mongodb-javascript-stack", # The mongodb-javascript-stack command executes code in # order to dump JavaScript backtraces and should therefore - # should be one of the last analysis commands. + # be one of the last analysis commands. "set confirm off", "quit", ] |