From 2fdd8928903f86362381dd6f52d6ef10a2cda041 Mon Sep 17 00:00:00 2001 From: Christoph Pakulski Date: Mon, 30 Nov 2020 20:47:38 -0500 Subject: [PATCH] tcmalloc changed and the data coming out of tcmalloc::MallocExtension::GetNumericProperty("generic.current_allocated_bytes") (#14165) Commit Message: tcmalloc changed and the data coming out of tcmalloc::MallocExtension::GetNumericProperty("generic.current_allocated_bytes") no longer appears to be deterministic, even in unthreaded tests. So disable exact mem checks till we sort that out Additional Description: Risk Level: low Testing: just thread_local_store_test Docs Changes: n/a Release Notes: n/a no longer appears to be deterministic, even in unthreaded tests. So disable exact mem checks till we sort that out Signed-off-by: Joshua Marantz Signed-off-by: Christoph Pakulski Co-authored-by: Joshua Marantz --- test/common/stats/stat_test_utility.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/common/stats/stat_test_utility.cc b/test/common/stats/stat_test_utility.cc index cc0f0a8d47a7..9ee2ea2be10a 100644 --- a/test/common/stats/stat_test_utility.cc +++ b/test/common/stats/stat_test_utility.cc @@ -119,20 +119,28 @@ MemoryTest::Mode MemoryTest::mode() { const size_t end_mem = Memory::Stats::totalCurrentlyAllocated(); bool can_measure_memory = end_mem > start_mem; + // As of Oct 8, 2020, tcmalloc has changed such that Memory::Stats::totalCurrentlyAllocated + // is not deterministic, even with single-threaded tests. When possible, this should be fixed, + // and the following block of code uncommented. This affects approximate comparisons, not + // just exact ones. +#if 0 if (getenv("ENVOY_MEMORY_TEST_EXACT") != nullptr) { // Set in "ci/do_ci.sh" for 'release' tests. RELEASE_ASSERT(can_measure_memory, "$ENVOY_MEMORY_TEST_EXACT is set for canonical memory measurements, " "but memory measurement looks broken"); return Mode::Canonical; } else { - // Different versions of STL and other compiler/architecture differences may - // also impact memory usage, so when not compiling with MEMORY_TEST_EXACT, - // memory comparisons must be given some slack. There have recently emerged - // some memory-allocation differences between development and Envoy CI and - // Bazel CI (which compiles Envoy as a test of Bazel). - return can_measure_memory ? Mode::Approximate : Mode::Disabled; +#endif + // Different versions of STL and other compiler/architecture differences may + // also impact memory usage, so when not compiling with MEMORY_TEST_EXACT, + // memory comparisons must be given some slack. There have recently emerged + // some memory-allocation differences between development and Envoy CI and + // Bazel CI (which compiles Envoy as a test of Bazel). + return can_measure_memory ? Mode::Approximate : Mode::Disabled; +#if 0 } #endif +#endif } Counter& TestStore::counterFromString(const std::string& name) {