Skip to content

testing: Fuzz testing with fuzztime flag sometimes fails incorrectly with "context deadline exceeded" #75804

@erap320

Description

@erap320

Go version

go1.25.0 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/elia.battiston/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/elia.battiston/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/9_/ds0mpwns1nx7lw0mpwl4klk40000gq/T/go-build2080843811=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/elia.battiston/git/go-1.25.0-fuzztime-bug/go.mod'
GOMODCACHE='/Users/elia.battiston/go/pkg/mod'
GONOPROXY='github.com'
GONOSUMDB='github.com'
GOOS='darwin'
GOPATH='/Users/elia.battiston/go'
GOPRIVATE='github.com'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/elia.battiston/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.darwin-arm64'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/elia.battiston/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/elia.battiston/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.darwin-arm64/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25.0'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I created a fuzz test on a function that cannot fail.
I then repeatedly executed fuzz testing with a maximum duration of 5s, with the following command:
go test . -fuzz="FuzzImpossibleFailure" -fuzztime=5s

The minimal example to reproduce the issue can be found here: https://github.com/erap320/go-1.25.0-fuzztime-bug

What did you see happen?

After many executions, one of them fails with the following output:

ok      fuzztest        5.307s
fuzz: elapsed: 0s, gathering baseline coverage: 0/3 completed
fuzz: elapsed: 0s, gathering baseline coverage: 3/3 completed, now fuzzing with 10 workers
fuzz: elapsed: 3s, execs: 1026946 (342299/sec), new interesting: 0 (total: 3)
fuzz: elapsed: 5s, execs: 1755480 (346861/sec), new interesting: 0 (total: 3)
--- FAIL: FuzzImpossibleFailure (5.10s)
    context deadline exceeded
FAIL
exit status 1
FAIL    fuzztest        5.314s

This seems related to #72104

What did you expect to see?

I would not expect the fuzzing process to fail unless the tested function fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions