]> Cypherpunks repositories - gostls13.git/commit
[dev.fuzz] testing,internal/fuzz: prevent unbounded memory growth
authorRoland Shoemaker <roland@golang.org>
Sun, 2 May 2021 01:46:22 +0000 (18:46 -0700)
committerRoland Shoemaker <roland@golang.org>
Fri, 7 May 2021 14:24:10 +0000 (14:24 +0000)
commit510e711dd36999f1800678909bb7fdb448aa074f
treef0b530310fabc4cc01f0f9a3a4f59f8c5d58fefe
parentaf3237eaf9cf46e6a02a3b53447e49c55abd4f00
[dev.fuzz] testing,internal/fuzz: prevent unbounded memory growth

Usage of f.testContext.match.fullName to generate the test name causes
unbounded memory growth, eventually causing the fuzzer to slow down
as memory pressure increases.

Each time fuzzFn is invoked it generates a unique string and stores it
in a map. With the fuzzer running at around 100k executions per second
this consumed around ~30GB of memory in a handful of minutes.

Instead just use the base name of the test for mutated inputs, a special
name for seeded inputs, and the filename for inputs from the input
corpus.

Change-Id: I083f47df7e82f0c6b0bda244f158233784a13029
Reviewed-on: https://go-review.googlesource.com/c/go/+/316030
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
src/cmd/go/testdata/script/test_fuzz_mutate_crash.txt
src/go/build/deps_test.go
src/internal/fuzz/fuzz.go
src/testing/fuzz.go