diff options
author | Richard Samuels <richard.samuels@mongodb.com> | 2020-05-28 16:21:17 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-05 13:24:34 +0000 |
commit | 38b125fc08c34b67aedf04d47a77c0dda45a7b89 (patch) | |
tree | bdd5f1cb536064999314b9de197ae7c6d3632e72 | |
parent | 7074dee1fbf6763c0d463c377c2e47d8ef2c4f6f (diff) | |
download | mongo-38b125fc08c34b67aedf04d47a77c0dda45a7b89.tar.gz |
SERVER-47312 hang_analyzer: enable on ASAN builders without running gcore
-rw-r--r-- | buildscripts/resmokelib/config.py | 4 | ||||
-rw-r--r-- | buildscripts/resmokelib/configure_resmoke.py | 10 | ||||
-rw-r--r-- | buildscripts/resmokelib/core/programs.py | 2 | ||||
-rw-r--r-- | etc/evergreen.yml | 11 | ||||
-rw-r--r-- | jstests/resmoke_selftest/shell_hang_analyzer.js | 12 | ||||
-rw-r--r-- | src/mongo/shell/servers.js | 15 | ||||
-rw-r--r-- | src/mongo/shell/utils.js | 1 |
7 files changed, 23 insertions, 32 deletions
diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py index 148cbefd2be..806ed8c168d 100644 --- a/buildscripts/resmokelib/config.py +++ b/buildscripts/resmokelib/config.py @@ -46,7 +46,6 @@ DEFAULT_GENNY_EXECUTABLE = os.path.normpath("genny/build/src/driver/genny") # Names below correspond to how they are specified via the command line or in the options YAML file. DEFAULTS = { "always_use_log_files": False, - "is_asan_build": False, "archive_limit_mb": 5000, "archive_limit_tests": 10, "base_port": 20000, @@ -237,9 +236,6 @@ ARCHIVE_LIMIT_MB = None # The limit number of tests to archive for an Evergreen task. ARCHIVE_LIMIT_TESTS = None -# True if resmoke is running against and ASAN build. -IS_ASAN_BUILD = None - # The starting port number to use for mongod and mongos processes spawned by resmoke.py and the # mongo shell. BASE_PORT = None diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py index 66ed60f885f..719e1d8d40e 100644 --- a/buildscripts/resmokelib/configure_resmoke.py +++ b/buildscripts/resmokelib/configure_resmoke.py @@ -66,15 +66,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many config = _config.DEFAULTS.copy() - # Use RSK_ prefixed environment variables to indicate resmoke-specific values. - # The list of configuration is detailed in config.py - resmoke_env_prefix = 'RSK_' - for key in os.environ.keys(): - if key.startswith(resmoke_env_prefix): - # Windows env vars are case-insensitive, we use lowercase to be consistent - # with existing resmoke options. - config[key[len(resmoke_env_prefix):].lower()] = os.environ[key] - # Override `config` with values from command line arguments. cmdline_vars = vars(values) for cmdline_key in cmdline_vars: @@ -92,7 +83,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many config.update(user_config) _config.ALWAYS_USE_LOG_FILES = config.pop("always_use_log_files") - _config.IS_ASAN_BUILD = config.pop("is_asan_build") _config.BASE_PORT = int(config.pop("base_port")) _config.BUILDLOGGER_URL = config.pop("buildlogger_url") _config.DBPATH_PREFIX = _expand_user(config.pop("dbpath_prefix")) diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py index 26205944ff9..aee459e821f 100644 --- a/buildscripts/resmokelib/core/programs.py +++ b/buildscripts/resmokelib/core/programs.py @@ -365,8 +365,6 @@ def mongo_shell_program( # pylint: disable=too-many-branches,too-many-locals,to test_data["setParameters"] = mongod_set_parameters test_data["setParametersMongos"] = mongos_set_parameters - test_data["isAsanBuild"] = config.IS_ASAN_BUILD - test_data["undoRecorderPath"] = config.UNDO_RECORDER_PATH # There's a periodic background thread that checks for and aborts expired transactions. diff --git a/etc/evergreen.yml b/etc/evergreen.yml index c3e1bb6c002..fd4a37963a4 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1463,7 +1463,6 @@ functions: set +o errexit PATH="$path_value" \ AWS_PROFILE=${aws_profile_remote} \ - RSK_is_asan_build=${is_asan_build|""} \ ${gcov_environment} \ ${lang_environment} \ ${san_options} \ @@ -3571,7 +3570,7 @@ functions: hang_analyzer_option="-o file -o stdout -p ${hang_analyzer_processes|dbtest,java,mongo,mongod,mongos,python,_test}" - if [ ${is_asan_build|false} = false ]; then + if [ ${hang_analyzer_dump_core|true} = true ]; then hang_analyzer_option="-c $hang_analyzer_option" fi @@ -12309,7 +12308,7 @@ buildvariants: multiversion_platform: ubuntu1804 multiversion_edition: enterprise resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under ASAN build. - is_asan_build: true + hang_analyzer_dump_core: false scons_cache_scope: shared test_flags: --excludeWithAnyTags=requires_fast_memory tasks: @@ -12376,7 +12375,7 @@ buildvariants: multiversion_platform: ubuntu1804 multiversion_edition: enterprise resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under ASAN build. - is_asan_build: true + hang_analyzer_dump_core: false scons_cache_scope: shared test_flags: --excludeWithAnyTags=requires_fast_memory tasks: @@ -12466,7 +12465,7 @@ buildvariants: san_options: UBSAN_OPTIONS="print_stacktrace=1" LSAN_OPTIONS="suppressions=etc/lsan.suppressions:report_objects=1" ASAN_OPTIONS=detect_leaks=1:check_initialization_order=true:strict_init_order=true:abort_on_error=1:disable_coredump=0:handle_abort=1 compile_flags: --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --allocator=system --sanitize=undefined,address --ssl -j$(grep -c ^processor /proc/cpuinfo) --nostrip resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under {A,UB}SAN build. - is_asan_build: true + hang_analyzer_dump_core: false scons_cache_scope: shared max_sub_suites: 100 tasks: @@ -12494,7 +12493,7 @@ buildvariants: san_options: UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" LSAN_OPTIONS="suppressions=etc/lsan.suppressions:report_objects=1" ASAN_OPTIONS=detect_leaks=1:check_initialization_order=true:strict_init_order=true:abort_on_error=1:disable_coredump=0:handle_abort=1 compile_flags: LINKFLAGS=-nostdlib++ LIBS=stdc++ --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --allocator=system --sanitize=undefined,address,fuzzer --ssl -j$(grep -c ^processor /proc/cpuinfo) --nostrip resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under {A,UB}SAN build. - is_asan_build: true + hang_analyzer_dump_core: false scons_cache_scope: shared display_tasks: - *libfuzzertests diff --git a/jstests/resmoke_selftest/shell_hang_analyzer.js b/jstests/resmoke_selftest/shell_hang_analyzer.js index 8cd619f19f6..9fc58b628cd 100644 --- a/jstests/resmoke_selftest/shell_hang_analyzer.js +++ b/jstests/resmoke_selftest/shell_hang_analyzer.js @@ -28,11 +28,17 @@ try { const lines = rawMongoProgramOutput().split('\n'); - if (TestData.isAsanBuild) { - // Nothing should be executed, so there's no output. - assert.eq(lines, ['']); + if (_isAddressSanitizerActive()) { + assert.soon(() => { + // On ASAN builds, we never dump the core during hang analyzer runs, + // nor should the output be empty (empty means it didn't run). + // If you're trying to debug why this test is failing, confirm that the + // hang_analyzer_dump_core expansion has not been set to true. + return !anyLineMatches(lines, /Dumping core/) && lines.length != 0; + }); } else { assert.soon(() => { + // Outside of ASAN builds, we expect the core to be dumped. return anyLineMatches(lines, /Dumping core/); }); } diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index d7ce35cda50..6170046a15d 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -133,11 +133,6 @@ function runHangAnalyzer(pids) { return; } - if (TestData.isAsanBuild) { - print('Skipping runHangAnalyzer: ASAN build'); - return; - } - if (typeof pids === 'undefined') { pids = getPids(); } @@ -149,8 +144,16 @@ function runHangAnalyzer(pids) { // add 0 to convert to Number. pids = pids.map(p => p + 0).join(','); print(`Running hang analyzer for pids [${pids}]`); + const scriptPath = pathJoin('.', 'buildscripts', 'resmoke.py'); - return runProgram('python', scriptPath, 'hang-analyzer', '-c', '-d', pids); + const args = ['python', scriptPath, 'hang-analyzer', '-d', pids]; + + // Enable core dumps if not an ASAN build. + if (!_isAddressSanitizerActive()) { + args.push('-c'); + } + + return runProgram(...args); } MongoRunner.runHangAnalyzer = runHangAnalyzer; diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index 4f210d7b0b4..4b905500e2e 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -358,7 +358,6 @@ jsTestOptions = function() { // is shut down. alwaysUseLogFiles: TestData.alwaysUseLogFiles || false, skipCheckOrphans: TestData.skipCheckOrphans || false, - isAsanBuild: TestData.isAsanBuild, inEvergreen: TestData.inEvergreen || false, undoRecorderPath: TestData.undoRecorderPath, |