Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ktalg opened this issue Nov 23, 2024 · 2 comments
Open

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

ktalg opened this issue Nov 23, 2024 · 2 comments

Comments

@ktalg
Copy link

ktalg commented Nov 23, 2024

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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/http2/transport.go:621 +0x1a2
golang.org/x/net/http2.(*Transport).RoundTrip(0x10df80?, 0x76fba0?)
	/tmp/gopath4185787864/pkg/mod/golang.org/x/[email protected]/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

@gabyhelp
Copy link

@jfrech
Copy link

jfrech commented Nov 24, 2024

The commit which introduced "shouldRetryDial" feels like a hotfix to me: It sloppily tries to rediscover cancelation sources instead of tracking connection state.

Cf. https://cs.opensource.google/go/x/net/+/master:http2/client_conn_pool.go;bpv=1;bpt=0;drc=bbd867fde50dd296d9785dcc484ce8f6125e28ac;dlc=e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f [2024-11-24]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants