Skip to content

Commit

Permalink
tcmalloc changed and the data coming out of tcmalloc::MallocExtension…
Browse files Browse the repository at this point in the history
…::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 <jmarantz@google.com>
Signed-off-by: Christoph Pakulski <christoph@tetrate.io>

Co-authored-by: Joshua Marantz <jmarantz@google.com>
  • Loading branch information
cpakulski and jmarantz authored Dec 1, 2020
1 parent c4ee861 commit 2fdd892
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/common/stats/stat_test_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2fdd892

Please sign in to comment.