golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.72k stars 17.5k forks source link

x/perf/benchseries: panic in (*Cell).hash #66685

Open pmur opened 5 months ago

pmur commented 5 months ago

Go version

go1.21.8

Output of go env in your module/workspace:

GOARCH=amd64
GOOS=linux

What did you do?

Using the perf app from x/build, after uploading a new set of benchmark results, I run the cron/sync API, and it panics with a nil pointer error. I am running a local copy with minor modifications to support ppc64le.

In my particular case, a benchmark was present in the experiment results, but not the baseline results.

What did you see happen?

In the perf logs, I see:

2024/04/03 23:49:06 http: panic serving 10.0.2.100:58740: runtime error: invalid memory address or nil pointer dereference
goroutine 106 [running]:
net/http.(*conn).serve.func1()
    /usr/lib/golang/src/net/http/server.go:1868 +0xb9
panic({0xe6cb60?, 0x1d37170?})
    /usr/lib/golang/src/runtime/panic.go:920 +0x270
golang.org/x/perf/benchseries.(*Cell).hash(0x7f2c3683b108?)
    /home/murp/go/pkg/mod/golang.org/x/perf@v0.0.0-20240305160248-5eefbfdba9dd/benchseries/benchseries.go:733
golang.org/x/perf/benchseries.(*ComparisonSeries).AddSummaries.withBootstrap.func1(0xc000550980)
    /home/murp/go/pkg/mod/golang.org/x/perf@v0.0.0-20240305160248-5eefbfdba9dd/benchseries/benchseries.go:854 +0x87
golang.org/x/perf/benchseries.(*ComparisonSeries).AddSummaries(0xc00023d280, 0x1192cb8?, 0xc000154320?)
    /home/murp/go/pkg/mod/golang.org/x/perf@v0.0.0-20240305160248-5eefbfdba9dd/benchseries/benchseries.go:928 +0x337
golang.org/x/build/perf/app.(*App).compareAndPush(0xc0000009c0?, {0x1192cb8, 0xc000154320}, {0x119b2d0, 0xc000000900}, 0xc0000009c0, 0x0?, {0x0, 0x0})
    /home/murp/git/build/perf/app/influx.go:352 +0x329
golang.org/x/build/perf/app.(*App).pushRunToInflux(0xc00014aa80, {0x1192cb8, 0xc000154320}, {0x119b2d0, 0xc000000900}, {0x0?, {0xc0001c8500?, 0x6f2922?}, 0x0?})
    /home/murp/git/build/perf/app/influx.go:307 +0x654
golang.org/x/build/perf/app.(*App).syncInflux(0xc00014aa80, {0x11901c0, 0xc00023a0e0}, 0x0?)
    /home/murp/git/build/perf/app/influx.go:91 +0x82f
net/http.HandlerFunc.ServeHTTP(0x412265?, {0x11901c0?, 0xc00023a0e0?}, 0x10?)
    /usr/lib/golang/src/net/http/server.go:2136 +0x29
net/http.(*ServeMux).ServeHTTP(0xc000135b18?, {0x11901c0, 0xc00023a0e0}, 0xc00024e300)
    /usr/lib/golang/src/net/http/server.go:2514 +0x142
golang.org/x/build/internal/https.ListenAndServeOpts.func1({0x11901c0?, 0xc00023a0e0?}, 0xc000242160?)
    /home/murp/git/build/internal/https/https.go:73 +0x8f
net/http.HandlerFunc.ServeHTTP(0x1d9db00?, {0x11901c0?, 0xc00023a0e0?}, 0xc000135b50?)
    /usr/lib/golang/src/net/http/server.go:2136 +0x29
net/http.serverHandler.ServeHTTP({0xc0003386f0?}, {0x11901c0?, 0xc00023a0e0?}, 0x6?)
    /usr/lib/golang/src/net/http/server.go:2938 +0x8e
net/http.(*conn).serve(0xc000192090, {0x1192c80, 0xc0001904b0})
    /usr/lib/golang/src/net/http/server.go:2009 +0x5f4
created by net/http.(*Server).Serve in goroutine 133
    /usr/lib/golang/src/net/http/server.go:3086 +0x5cb

What did you expect to see?

No panic, maybe a log warning about measurements which have no baseline.

gopherbot commented 5 months ago

Change https://go.dev/cl/576695 mentions this issue: benchseries: do not crash if no denominator is present