summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2017-06-20 12:16:38 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2017-06-20 12:16:38 -0400
commit20c5ecac947b69ea8a03660cef8ac1e1251b43e8 (patch)
tree59363443a2970f4641b08d9f6331027684df12b4
parent603287e0f6c93f0737d3abcf80f508769487aa54 (diff)
downloadmongo-20c5ecac947b69ea8a03660cef8ac1e1251b43e8.tar.gz
SERVER-29646 hang_analyzer.py signals python processes before attaching to any processes
-rwxr-xr-xbuildscripts/hang_analyzer.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/buildscripts/hang_analyzer.py b/buildscripts/hang_analyzer.py
index e017f2a2a34..d9e14553572 100755
--- a/buildscripts/hang_analyzer.py
+++ b/buildscripts/hang_analyzer.py
@@ -690,7 +690,21 @@ def main():
max_dump_size_bytes = int(options.max_core_dumps_size) * 1024 * 1024
- # Dump all other processes including go programs, except python & java.
+ # Dump python processes by signalling them. The resmoke.py process will generate
+ # the report.json, when signalled, so we do this before attaching to other processes.
+ for (pid, process_name) in [(p, pn) for (p, pn) in processes if pn.startswith("python")]:
+ # On Windows, we set up an event object to wait on a signal. For Cygwin, we register
+ # a signal handler to wait for the signal since it supports POSIX signals.
+ if _is_windows:
+ root_logger.info("Calling SetEvent to signal python process %s with PID %d" %
+ (process_name, pid))
+ signal_event_object(root_logger, pid)
+ else:
+ root_logger.info("Sending signal SIGUSR1 to python process %s with PID %d" %
+ (process_name, pid))
+ signal_process(root_logger, pid, signal.SIGUSR1)
+
+ # Dump all processes, except python & java.
for (pid, process_name) in [(p, pn) for (p, pn) in processes
if not re.match("^(java|python)", pn)]:
process_logger = get_process_logger(options.debugger_output, pid, process_name)
@@ -715,19 +729,6 @@ def main():
(process_name, pid))
signal_process(root_logger, pid, signal.SIGABRT)
- # Dump python processes by signalling them.
- for (pid, process_name) in [(p, pn) for (p, pn) in processes if pn.startswith("python")]:
- # On Windows, we set up an event object to wait on a signal. For Cygwin, we register
- # a signal handler to wait for the signal since it supports POSIX signals.
- if _is_windows:
- root_logger.info("Calling SetEvent to signal python process %s with PID %d" %
- (process_name, pid))
- signal_event_object(root_logger, pid)
- else:
- root_logger.info("Sending signal SIGUSR1 to python process %s with PID %d" %
- (process_name, pid))
- signal_process(root_logger, pid, signal.SIGUSR1)
-
root_logger.info("Done analyzing all processes for hangs")
if __name__ == "__main__":