test: replace flaky StringMatcher.Memory with deterministic sizeof bounds#44701
test: replace flaky StringMatcher.Memory with deterministic sizeof bounds#44701phlax merged 4 commits intoenvoyproxy:mainfrom
Conversation
|
botsplanation:
Changes
// String-holding alternatives: std::string + bool (padded) only.
static_assert(sizeof(Matchers::ExactStringMatcher) <= sizeof(std::string) + sizeof(void*), ...);
// ... same for Prefix, Suffix, Contains
// Pointer-holding alternatives: one unique_ptr only.
static_assert(sizeof(Matchers::RegexStringMatcher) <= 2 * sizeof(void*), ...);
static_assert(sizeof(Matchers::CustomStringMatcher) <= 2 * sizeof(void*), ...);
// StringMatcherImpl: 2 vtable ptrs + variant (largest alt + discriminant).
static_assert(sizeof(Matchers::StringMatcherImpl) <= sizeof(std::string) + 4 * sizeof(void*), ...);Bounds use
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
Original promptBackground
It asserts that the tcmalloc-reported This test is fundamentally broken and is the source of recurring gcc CI flakes (~5/1000 reproduction rate, observed continuously on
The recent failure mode, for reference: — i.e. only ~24 KiB over a ~16 MiB ceiling. GoalRemove the flaky What to doIn
The point of the redesign was that Replacement test designIn 1. Compile-time
|
…atic_asserts Signed-off-by: Ryan Northey <ryan@synca.io>
Signed-off-by: Ryan Northey <ryan@synca.io>
|
/retest flakey github |
Signed-off-by: Ryan Northey <ryan@synca.io>
There was a problem hiding this comment.
This looks like an improvement, though it loses the "size with data in it" measuring that the old way was doing. However, the old way was measuring "size with data in it" in a way that, if the size-per-type went up by 4, the 8K of mystery slop space would mean the test wouldn't fail it would just become flaky. And it also was testing with 1000 different lengths of string, which would give unrealistic outcomes for e.g. changes to string types anyway, so while it might have drawn attention to the memory impact of a change, it would only be confusing, often meaningless attention. Plus it was flaky.
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as envoyproxy#37782, deterministic. --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (envoyproxy#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (envoyproxy#37782, envoyproxy#43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (#37782, #43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (#37782, #43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as #37782, deterministic. --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (#37782, #43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
…unds (#44701) Replaces `TEST_F(StringMatcher, Memory)` with `StringMatcher.SizeIsBounded`. The old test asserted tcmalloc page-level `consumedBytes()` against hand-tuned ceilings, which produced ~5/1000 CI flakes and had to be re-tuned on every tcmalloc/abseil/protobuf bump (#37782, #43467). The new test bounds `sizeof` of each variant alternative and of `StringMatcherImpl` itself, expressed in `sizeof(std::string)` / `sizeof(void*)` for libc++ / libstdc++ portability. Same intent as --------- Signed-off-by: Ryan Northey <ryan@synca.io>
Replaces
TEST_F(StringMatcher, Memory)withStringMatcher.SizeIsBounded.The old test asserted tcmalloc page-level
consumedBytes()againsthand-tuned ceilings, which produced ~5/1000 CI flakes and had to be
re-tuned on every tcmalloc/abseil/protobuf bump (#37782, #43467).
The new test bounds
sizeofof each variant alternative and ofStringMatcherImplitself, expressed insizeof(std::string)/sizeof(void*)for libc++ / libstdc++ portability. Same intent as#37782, deterministic.