agent icon indicating copy to clipboard operation
agent copied to clipboard

Conflicting router patterns when built with Go 1.23

Open stefanb opened this issue 1 year ago • 9 comments

What's wrong?

Conflicting patterns detected when built with Go 1.23


$ grafana-agent --version
  panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at github.com/grafana/pyroscope-go/[email protected]/http/pprof/pprof.go:24):
  	GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

Steps to reproduce

When runing the tests for https://github.com/Homebrew/homebrew-core/pull/175310 the Grafana agent test failed with:

  ==> Testing grafana-agent
  ==> /opt/homebrew/Cellar/grafana-agent/0.41.1/bin/grafana-agent --version
  panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at github.com/grafana/pyroscope-go/[email protected]/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(...)
  	net/http/server.go:2805
  net/http.HandleFunc({0x14000074e70?, 0x10587ac8a?}, 0x107723ea0?)
  	net/http/server.go:2799 +0x9c
  net/http/pprof.init.0()
  	net/http/pprof/pprof.go:100 +0x94

System information

All, irrelevant

Software version

Grafana Agent v0.41.1

Configuration

No response

Logs

No response

stefanb avatar Jul 02 '24 06:07 stefanb

There were some changes in the routing patterns according to https://tip.golang.org/doc/go1.23#nethttppkgnethttp

The patterns used by ServeMux now allow one or more spaces or tabs after the method name. Previously, only a single space was permitted.

...but this should not cause such error.

stefanb avatar Jul 02 '24 06:07 stefanb

Fixed in https://github.com/grafana/pyroscope-go/releases/tag/godeltaprof%2Fv0.1.8 by https://github.com/grafana/pyroscope-go/commit/edd64fd9a09c27d2a839bdb8bdcfe832eecb98d6

gizmoguy avatar Aug 16 '24 04:08 gizmoguy

I got a very similar error trying to run Grafana Alloy with go 1.23. It works fine with go 1.22.

goroutine 1 [running]:
net/http.(*ServeMux).register(...)
net/http/server.go:2797
net/http.HandleFunc({0x14001af9800?, 0x109b3a330?}, 0x10baec9c0?)
net/http/server.go:2791 +0x9c
net/http/pprof.init.0()
net/http/pprof/pprof.go:100 +0x94
panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at [github.com/grafana/pyroscope-go/](http://github.com/grafana/pyroscope-go/)[[email protected]](mailto:[email protected])/http/pprof/pprof.go:24):
GET /debug/pprof/ matches fewer methods than /debug/pprof/delta_heap, but has a more general path pattern

llamafilm avatar Aug 22 '24 21:08 llamafilm

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

github-actions[bot] avatar Sep 25 '24 00:09 github-actions[bot]

This is preventing the bump of grafana-agent in Arch Linux

daurnimator avatar Sep 26 '24 01:09 daurnimator

I tried to build 11.2.5 with go version 1.22 and see that it fails to build with

go: go.work requires go >= 1.22.7 (running go 1.22.1; GOTOOLCHAIN=local)

With go = 1.22.7 it builds again.

rvdheij avatar Dec 05 '24 11:12 rvdheij

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

github-actions[bot] avatar Mar 11 '25 00:03 github-actions[bot]

Same error with go 1.24.1 on arm64 mac

han-steve avatar Mar 26 '25 22:03 han-steve

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

github-actions[bot] avatar Jun 06 '25 00:06 github-actions[bot]

happened again in latest installation via homebrew on macOS arm64 go version go1.24.4 darwin/arm64

admin@MyMacBook-Pro grafana-agent-config % grafana-agent-flow --version   
panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap" (registered at github.com/grafana/pyroscope-go/[email protected]/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(...)
        net/http/server.go:2872
net/http.HandleFunc({0x140010a1db8?, 0x10702dceb?}, 0x1091bc020?)
        net/http/server.go:2866 +0x98
net/http/pprof.init.0()
        net/http/pprof/pprof.go:100 +0x94

Installation steps according to https://grafana.com/docs/agent/latest/flow/get-started/install/macos/

admin@MyMacBook-Pro grafana-agent-config % brew tap grafana/grafana         
admin@MyMacBook-Pro grafana-agent-config % brew install grafana-agent-flow 
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> Downloading https://formulae.brew.sh/api/cask.jws.json
==> Fetching dependencies for grafana/grafana/grafana-agent-flow: node@20 and yarn
==> Fetching node@20
==> Downloading https://ghcr.io/v2/homebrew/core/node/20/manifests/20.19.2
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/b0fc3592e0b077d21cb582511a6a45d96d5bcd47d18de56c776481c9081cc84b--node@20-20.19.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/node/20/blobs/sha256:be55f8d8c39ef95fc8679c5134e220170a1018b8260d4e0ef094bc1a2b4a9f75
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/438b9546d0897ff99eb4fd2112ca71f0902eb52bcaed3d159283e0aa10344bc1--node@20--20.19.2.arm64_sequoia.bottle.tar.gz
==> Fetching yarn
==> Downloading https://ghcr.io/v2/homebrew/core/yarn/manifests/1.22.22-1
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/7197dcc3de90494ec6ccaf7dbbab823941df7c534801698096c2d1e11563e32d--yarn-1.22.22-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/yarn/blobs/sha256:edb63a1b15d560263270324b63bee4c2aa8145197636a755436cc14424fc1e12
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/633bf169b351dcf75b6cf471ac3915dc34c5ad571f50142cd0acb42149c9eddf--yarn--1.22.22.all.bottle.1.tar.gz
==> Fetching grafana/grafana/grafana-agent-flow
==> Downloading https://github.com/grafana/agent/archive/refs/tags/v0.44.2.tar.gz
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/6c2d0fc03737ee40144da531643ad2383639d9f492cf0c47aed435277e2b645d--agent-0.44.2.tar.gz
==> Installing grafana-agent-flow from grafana/grafana
==> Installing dependencies for grafana/grafana/grafana-agent-flow: node@20 and yarn
==> Installing grafana/grafana/grafana-agent-flow dependency: node@20
==> Downloading https://ghcr.io/v2/homebrew/core/node/20/manifests/20.19.2
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/b0fc3592e0b077d21cb582511a6a45d96d5bcd47d18de56c776481c9081cc84b--node@20-20.19.2.bottle_manifest.json
==> Pouring [email protected]_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/node@20/20.19.2: 2,068 files, 51MB
==> Installing grafana/grafana/grafana-agent-flow dependency: yarn
==> Downloading https://ghcr.io/v2/homebrew/core/yarn/manifests/1.22.22-1
Already downloaded: /Users/xiezhh/Library/Caches/Homebrew/downloads/7197dcc3de90494ec6ccaf7dbbab823941df7c534801698096c2d1e11563e32d--yarn-1.22.22-1.bottle_manifest.json
==> Pouring yarn--1.22.22.all.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/yarn/1.22.22: 16 files, 5MB
==> Installing grafana/grafana/grafana-agent-flow
==> yarn
==> yarn run build
==> go build -ldflags=-s -w -X github.com/grafana/agent/pkg/build.Branch=HEAD -X github.com/grafana/agent/pkg/build.Version=v0.44.2 -X github.com/grafana
==> Caveats
The agent uses a configuration file that you can customize before running:
  /opt/homebrew/etc/grafana-agent-flow/config.river

To start grafana/grafana/grafana-agent-flow now and restart at login:
  brew services start grafana/grafana/grafana-agent-flow
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/grafana-agent-flow/bin/grafana-agent-flow run /opt/homebrew/etc/grafana-agent-flow/config.river --server.http.listen-addr\=127.0.0.1:12345 --storage.path\=/opt/homebrew/etc/grafana-agent-flow/data
==> Summary
🍺  /opt/homebrew/Cellar/grafana-agent-flow/0.44.2: 9 files, 192.9MB, built in 1 minute 13 seconds
==> Running `brew cleanup grafana-agent-flow`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> grafana-agent-flow
The agent uses a configuration file that you can customize before running:
  /opt/homebrew/etc/grafana-agent-flow/config.river

To start grafana/grafana/grafana-agent-flow now and restart at login:
  brew services start grafana/grafana/grafana-agent-flow
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/grafana-agent-flow/bin/grafana-agent-flow run /opt/homebrew/etc/grafana-agent-flow/config.river --server.http.listen-addr\=127.0.0.1:12345 --storage.path\=/opt/homebrew/etc/grafana-agent-flow/data

JiSuanSiWeiShiXun avatar Jun 18 '25 02:06 JiSuanSiWeiShiXun