summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Petrel <etienne.petrel@mongodb.com>2022-04-18 09:46:46 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-18 15:25:09 +0000
commitc0d96bdd79055b54ae825b5df5bef79d2ddc8876 (patch)
tree44fed18d7f93e326f04b6d84426a81410448e11f
parent07d24027d580adf1a43edd10c13b542d596b48b1 (diff)
downloadmongo-c0d96bdd79055b54ae825b5df5bef79d2ddc8876.tar.gz
Import wiredtiger: 5d5980c6f12188d5c33feeee5da2501ccd0f7498 from branch mongodb-master
ref: 3447d6b9a1..5d5980c6f1 for: 6.0.0-rc0 WT-8328 Dump and upload backtraces when python and test format fails in evergreen testing
-rw-r--r--src/third_party/wiredtiger/import.data2
-rwxr-xr-xsrc/third_party/wiredtiger/test/evergreen.yml36
-rw-r--r--src/third_party/wiredtiger/test/evergreen/print_stack_trace.py (renamed from src/third_party/wiredtiger/test/evergreen/print_python_stack_trace.py)59
3 files changed, 69 insertions, 28 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index ec78b53fcc5..14bc6aea2cb 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "3447d6b9a192fd6325782f334899faaa139b1b3f"
+ "commit": "5d5980c6f12188d5c33feeee5da2501ccd0f7498"
}
diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml
index f7ceb1ae574..3c661f23e10 100755
--- a/src/third_party/wiredtiger/test/evergreen.yml
+++ b/src/third_party/wiredtiger/test/evergreen.yml
@@ -11,7 +11,7 @@ stepback: true
pre:
- func: "cleanup"
post:
- - func: "print python stacktrace"
+ - func: "dump stacktraces"
- func: "dump stderr/stdout"
- func: "upload artifact"
vars:
@@ -504,16 +504,30 @@ functions:
display_name: WT Hang Analyzer Output - Execution ${execution}
remote_file: wiredtiger/${build_variant}/${revision}/wt_hang_analyzer/wt-hang-analyzer_${task_name}_${build_id}${postfix|}.tgz
- "print python stacktrace":
- command: shell.exec
- params:
- working_dir: "wiredtiger/cmake_build"
- script: |
- set -o errexit
- set -o verbose
- if [ -d "WT_TEST" ]; then
- ${python_binary|python3} ../test/evergreen/print_python_stack_trace.py -e ${python_binary|python3} -c WT_TEST -l .
- fi
+ "dump stacktraces":
+ - command: shell.exec
+ params:
+ working_dir: "wiredtiger/cmake_build"
+ script: |
+ set -o errexit
+ set -o verbose
+ # Parse through any failures inside the WT_TEST directory.
+ ${python_binary|python3} ../test/evergreen/print_stack_trace.py --unit_test -e ${python_binary|python3} -c WT_TEST -l .
+
+ # Look through the stress format directory for any coredumps.
+ cd test/format
+ ${python_binary|python3} ../../../test/evergreen/print_stack_trace.py --format -e ./t -c . -l .
+ - command: s3.put
+ params:
+ aws_secret: ${aws_secret}
+ aws_key: ${aws_key}
+ local_files_include_filter:
+ - wiredtiger/cmake_build/*stacktrace.txt
+ - wiredtiger/cmake_build/test/format/*stacktrace.txt
+ bucket: build_external
+ permissions: public-read
+ content_type: text/plain
+ remote_file: wiredtiger/${build_variant}/${revision}/artifacts/
"dump stderr/stdout":
command: shell.exec
diff --git a/src/third_party/wiredtiger/test/evergreen/print_python_stack_trace.py b/src/third_party/wiredtiger/test/evergreen/print_stack_trace.py
index 4dd81654ac3..9758bc1763f 100644
--- a/src/third_party/wiredtiger/test/evergreen/print_python_stack_trace.py
+++ b/src/third_party/wiredtiger/test/evergreen/print_stack_trace.py
@@ -51,20 +51,24 @@ class LLDBDumper:
"""Find the installed debugger."""
return which(debugger)
- def dump(self, exe_path: str, core_path: str):
+ def dump(self, exe_path: str, core_path: str, dump_all: bool, output_file: str):
"""Dump stack trace."""
if self.dbg is None:
sys.exit("Debugger lldb not found,"
"skipping dumping of {}".format(core_path))
- cmds = [
- "thread backtrace all -c 30",
- "quit"
- ]
+ if dump_all:
+ cmds.append("thread apply all backtrace -c 30")
+ else:
+ cmds.append("backtrace -c 30")
+ cmds.append("quit")
+ output = None
+ if (output_file):
+ output = open(output_file, "w")
subprocess.run([self.dbg, "--batch"] + [exe_path, "-c", core_path] +
list(itertools.chain.from_iterable([['-o', b] for b in cmds])),
- check=True)
+ check=True, stdout=output)
class GDBDumper:
@@ -77,7 +81,7 @@ class GDBDumper:
"""Find the installed debugger."""
return which(debugger)
- def dump(self, exe_path: str, core_path: str, lib_path: str):
+ def dump(self, exe_path: str, core_path: str, lib_path: str, dump_all: bool, output_file: str):
"""Dump stack trace."""
if self.dbg is None:
sys.exit("Debugger gdb not found,"
@@ -86,15 +90,20 @@ class GDBDumper:
cmds = []
if lib_path:
cmds.append("set solib-search-path " + lib_path)
- cmds.extend([
- "thread apply all backtrace 30",
- "quit"
- ])
+ if dump_all:
+ cmds.append("thread apply all backtrace 30")
+ else:
+ cmds.append("backtrace 30")
+ cmds.append("quit")
+
+ output = None
+ if (output_file):
+ output = open(output_file, "w")
subprocess.run([self.dbg, "--batch", "--quiet"] +
list(itertools.chain.from_iterable([['-ex', b] for b in cmds])) +
[exe_path, core_path],
- check=True)
+ check=True, stdout=output)
def main():
@@ -106,25 +115,43 @@ def main():
help='directory path to the core dumps',
required=True)
parser.add_argument('-l', '--lib_path', help='library path')
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument('--unit_test', action='store_true', help='Format core dumps from python unit tests')
+ group.add_argument('--format', action='store_true', help='Format core dumps from format tests')
args = parser.parse_args()
# Store the path of the core files as a list.
core_files = []
- regex = re.compile(r'.*dump.*python.*', re.IGNORECASE)
+ dump_all = args.unit_test
+
+ regex = None
+ if (args.format):
+ regex = re.compile(r'dump_t.*core', re.IGNORECASE)
+ elif (args.unit_test):
+ regex = re.compile(r'dump.*python.*core', re.IGNORECASE)
+
for root, _, files in os.walk(args.core_path):
for file in files:
if regex.match(file):
- core_files.extend([os.path.join(root, file)])
+ core_files.append(os.path.join(root, file))
for core_file_path in core_files:
print(border_msg(core_file_path), flush=True)
if sys.platform.startswith('linux'):
dbg = GDBDumper()
- dbg.dump(args.executable_path, core_file_path, args.lib_path)
+ dbg.dump(args.executable_path, core_file_path, args.lib_path, dump_all, None)
+
+ # Extract the filename from the core file path, to create a stacktrace output file.
+ file_name, _ = os.path.splitext(os.path.basename(core_file_path))
+ dbg.dump(args.executable_path, core_file_path, args.lib_path, True, file_name + ".stacktrace.txt")
elif sys.platform.startswith('darwin'):
# FIXME - macOS to be supported in WT-8976
# dbg = LLDBDumper()
- # dbg.dump(args.executable_path, core_file_path)
+ # dbg.dump(args.executable_path, core_file_path, dump_all)
+
+ # Extract the filename from the core file path, to create a stacktrace output file.
+ # file_name, _ = os.path.splitext(os.path.basename(core_file_path))
+ # dbg.dump(args.executable_path, core_file_path, args.lib_path, dump_all, file_name + ".stacktrace.txt")
pass
elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
# FIXME - Windows to be supported in WT-8937