grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.28k stars 172 forks source link

Alloy when compiled with go 1.23 crashes #1540

Open bschnei opened 3 weeks ago

bschnei commented 3 weeks ago

What's wrong?

Attempting to run alloy 1.3.1 produces the following error:

panic: pattern "GET /debug/pprof/" (registered at /usr/lib/go/src/net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at /home/ben/repos/aur/grafana-alloy/src/pkg/mod/github.com/grafana/pyroscope-go/godeltaprof@v0.1.7/http/pprof/pprof.go:24):
    GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

goroutine 1 [running]:
net/http.(*ServeMux).register(...)
    /usr/lib/go/src/net/http/server.go:2797
net/http.HandleFunc({0xc002f3baa0?, 0x80b1934?}, 0x6e3b9e0?)
    /usr/lib/go/src/net/http/server.go:2791 +0x86
net/http/pprof.init.0()
    /usr/lib/go/src/net/http/pprof/pprof.go:100 +0x85

This error is new as of v1.3.1 and was not experienced following the same build process with v1.3.

Steps to reproduce

  1. clone v1.3.1 from github
  2. make alloy to compile
  3. ./build/alloy --version to test

System information

Linux 6.10.6

Software version

v1.3.1

Configuration

GOEXPERIMENT= GOOS=linux GOARCH=amd64 GOARM= CGO_ENABLED=1 go build  -ldflags "-X github.com/grafana/alloy/internal/build.Branch=makepkg -X github.com/grafana/alloy/internal/build.Version=v1.3.1 -X github.com/grafana/alloy/internal/build.Revision=e4979b2a2 -X github.com/grafana/alloy/internal/build.BuildUser=ben@desky -X github.com/grafana/alloy/internal/build.BuildDate=2024-08-23T17:00:54Z" -tags "" -o build/alloy .

Logs

No response

jkroepke commented 3 weeks ago

Having the same error, running from source

panic: pattern "GET /debug/pprof/" (registered at C:/Program Files/Go/src/net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at C:/Users/jok/go/pkg/mod/github.com/grafana/pyroscope-go/godeltaprof@v0.1.7/http/pprof/pprof.go:24):
        GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

goroutine 1 [running]:
net/http.(*ServeMux).register(...)
        C:/Program Files/Go/src/net/http/server.go:2797
net/http.HandleFunc({0xc001fc6288?, 0x7ff7cb45ef8a?}, 0x7ff7ca2ab260?)
        C:/Program Files/Go/src/net/http/server.go:2791 +0x86
net/http/pprof.init.0()
        C:/Program Files/Go/src/net/http/pprof/pprof.go:100 +0x85
defanator commented 3 weeks ago

Downgrading to go 1.22 fixed this for me. The issue seems to be somewhere in go 1.23.

(I tried multiple versions of alloy, every single one was panic'ing with the same result if built with go 1.23.)

defanator commented 3 weeks ago

See also https://github.com/grafana/agent/issues/6972.

bschnei commented 3 weeks ago

@defanator confirmed. Title updated. Thank you!

SpectatorNan commented 3 weeks ago

image the same in 1.22.6

bschnei commented 3 weeks ago

Hm. I built with go 1.22.5 and didn't get the error. Perhaps there was a breaking change in go from .5 to .6?! In any case, it seems like grafana has been addressing the issue on their side: https://github.com/grafana/pyroscope-go/releases/tag/godeltaprof%2Fv0.1.8

mattdurham commented 3 weeks ago

Fixed by forcing go 1.22 in the brew formula. Will keep this open so in 1.4 when we update go to 1.23 it doesnt get lost in the shuffle. (Though since that would affect everything everywhere it would be hard to miss!). This was caused by depends_on go pull 1.23. Changed to depends_on go@1.22.