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 19:50:05 +0000 |
commit | d57593228bcda502ea4f652eadf7c13d2b3e2c4c (patch) | |
tree | 38576b806c43c100567d916eaa7bc812e16c2b05 | |
parent | 467ab964f401a6922758cacfc84a345be340441e (diff) | |
download | mongo-d57593228bcda502ea4f652eadf7c13d2b3e2c4c.tar.gz |
SERVER-47312 hang_analyzer: enable on ASAN builders without running gcore
(cherry picked from commit 38b125fc08c34b67aedf04d47a77c0dda45a7b89)
-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 324f8ebdb6d..2f000ba833c 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_file": None, "archive_limit_mb": 5000, "archive_limit_tests": 10, @@ -235,9 +234,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 ed4bcf4ad22..f3f0c776345 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: @@ -93,7 +84,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many _config.ALWAYS_USE_LOG_FILES = config.pop("always_use_log_files") _config.ARCHIVE_FILE = config.pop("archive_file") - _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 2739f057ce1..e4e64bf21a2 100644 --- a/buildscripts/resmokelib/core/programs.py +++ b/buildscripts/resmokelib/core/programs.py @@ -351,8 +351,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 - # There's a periodic background thread that checks for and aborts expired transactions. # "transactionLifetimeLimitSeconds" specifies for how long a transaction can run before expiring # and being aborted by the background thread. It defaults to 60 seconds, which is too short to diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 81a4a00a2af..639c52210c5 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1408,7 +1408,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} \ @@ -3507,7 +3506,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 @@ -11994,7 +11993,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: @@ -12061,7 +12060,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: @@ -12151,7 +12150,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: @@ -12176,7 +12175,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 27ba3b88709..5c4ac4ee515 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 28a4c350f46..24d6b13cd80 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, // The ReplSetTest sets the slaveOk bit to true on its connections to the nodes in // the replset, which will result in running all commands with a readPreference of |