From 5b5c4c30bd853186178b447161f4f814b99b1404 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Thu, 8 Oct 2020 16:16:20 -0400 Subject: [PATCH] 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 Signed-off-by: Joshua Marantz Signed-off-by: Christoph Pakulski --- 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) {