Skip to content

x/net/http2: panic: runtime error: comparing uncomparable type #70535

@ktalg

Description

@ktalg

Go version

go version go1.23.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''

What did you do?

Recently, I fixed a potential issue with the etcd client. During our review and discussion, we noticed that there are similar scenarios in the Go standard library. I conducted some tests and got the same results: https://go.dev/play/p/-1W0mi3EMQS

My perspective on this is here. If this is confirmed to be a bug, it might be necessary to perform a comprehensive review of similar usages in the standard library.

What did you see happen?


panic: runtime error: comparing uncomparable type main.uncomparableCtx

goroutine 1 [running]:
golang.org/x/net/http2.shouldRetryDial(0xc0000262c0, 0x7724a0?)
	/tmp/gopath4185787864/pkg/mod/golang.org/x/net@v0.31.0/http2/client_conn_pool.go:297 +0x5d
golang.org/x/net/http2.(*clientConnPool).getClientConn(0xc000016e40, 0xc00012c280, {0xc000012170, 0xe}, 0x1)
	/tmp/gopath4185787864/pkg/mod/golang.org/x/net@v0.31.0/http2/client_conn_pool.go:98 +0x22a
golang.org/x/net/http2.(*clientConnPool).GetClientConn(0x6f88a6?, 0x5?, {0xc000012170?, 0xe?})
	/tmp/gopath4185787864/pkg/mod/golang.org/x/net@v0.31.0/http2/client_conn_pool.go:55 +0x1d
golang.org/x/net/http2.(*Transport).RoundTripOpt(0xc000108f00, 0xc00012c280, {0x10?, 0x0?})
	/tmp/gopath4185787864/pkg/mod/golang.org/x/net@v0.31.0/http2/transport.go:621 +0x1a2
golang.org/x/net/http2.(*Transport).RoundTrip(0x10df80?, 0x76fba0?)
	/tmp/gopath4185787864/pkg/mod/golang.org/x/net@v0.31.0/http2/transport.go:579 +0x17
net/http.send(0xc00012c280, {0x76fba0, 0xc000108f00}, {0xc000104c01?, 0x411d6b?, 0x0?})
	/usr/local/go-faketime/src/net/http/client.go:259 +0x5e4
net/http.(*Client).send(0xc000016d80, 0xc00012c280, {0x6f88bc?, 0x6?, 0x0?})
	/usr/local/go-faketime/src/net/http/client.go:180 +0x98
net/http.(*Client).do(0xc000016d80, 0xc00012c280)
	/usr/local/go-faketime/src/net/http/client.go:725 +0x8bc
net/http.(*Client).Do(...)
	/usr/local/go-faketime/src/net/http/client.go:590
main.main()
	/tmp/sandbox806163367/prog.go:35 +0x146

What did you expect to see?

Never panicking

Metadata

Metadata

Assignees

No one assigned

    Labels

    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