Repository: go
Issue: net/http: panic at Transport.roundTrip getConn
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.18.3 linux/amd64
</pre>

### Does this issue reproduce with the latest release?

yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/centos/.cache/go-build"
GOENV="/home/centos/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="git.17usoft.com"
GOMODCACHE="/usr/local/golang/gopath/pkg/mod"
GONOPROXY="git.17usoft.com"
GONOSUMDB="git.17usoft.com"
GOOS="linux"
GOPATH="/usr/local/golang/gopath"
GOPRIVATE="git.17usoft.com"
GOPROXY="https://goproxy.cn/"
GOROOT="/usr/local/golang/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/golang/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/centos/workspace/QOrderPreLoginSvr/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build791289068=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->



### What did you expect to see?



### What did you see instead?

program is panic in product env,and generate a linux core dump file,this is `dlv core {binary} {core file}` ouput

```bash
Type 'help' for list of commands.
(dlv) bt
 0  0x000000000046a541 in runtime.raise
    at /usr/local/golang/go/src/runtime/sys_linux_amd64.s:168
 1  0x000000000044e645 in runtime.dieFromSignal
    at /usr/local/golang/go/src/runtime/signal_unix.go:852
 2  0x000000000044f016 in runtime.sigfwdgo
    at /usr/local/golang/go/src/runtime/signal_unix.go:1066
 3  0x000000000044d367 in runtime.sigtrampgo
    at /usr/local/golang/go/src/runtime/signal_unix.go:430
 4  0x000000000046b36e in runtime.sigtrampgo
    at <autogenerated>:1
 5  0x000000000046a81d in runtime.sigtramp
    at /usr/local/golang/go/src/runtime/sys_linux_amd64.s:361
 6  0x00007f2b0e726630 in ???
    at ?:-1
 7  0x0000000000439269 in runtime.crash
    at /usr/local/golang/go/src/runtime/signal_unix.go:944
 8  0x0000000000439269 in runtime.fatalpanic
    at /usr/local/golang/go/src/runtime/panic.go:1092
 9  0x0000000000438a37 in runtime.gopanic
    at /usr/local/golang/go/src/runtime/panic.go:941
10  0x000000000044e516 in runtime.panicmem
    at /usr/local/golang/go/src/runtime/panic.go:220
11  0x000000000044e516 in runtime.sigpanic
    at /usr/local/golang/go/src/runtime/signal_unix.go:818
12  0x00000000007215c0 in net/http.(*Transport).roundTrip
    at /usr/local/golang/go/src/net/http/transport.go:581
13  0x00000000007084f9 in net/http.(*Transport).RoundTrip
    at /usr/local/golang/go/src/net/http/roundtrip.go:17
14  0x00000000006c9e18 in net/http.send
    at /usr/local/golang/go/src/net/http/client.go:252
Sending output to pager...
 0  0x000000000046a541 in runtime.raise
    at /usr/local/golang/go/src/runtime/sys_linux_amd64.s:168
 1  0x000000000044e645 in runtime.dieFromSignal
    at /usr/local/golang/go/src/runtime/signal_unix.go:852
 2  0x000000000044f016 in runtime.sigfwdgo
    at /usr/local/golang/go/src/runtime/signal_unix.go:1066
 3  0x000000000044d367 in runtime.sigtrampgo
    at /usr/local/golang/go/src/runtime/signal_unix.go:430
 4  0x000000000046b36e in runtime.sigtrampgo
    at <autogenerated>:1
 5  0x000000000046a81d in runtime.sigtramp
    at /usr/local/golang/go/src/runtime/sys_linux_amd64.s:361
 6  0x00007f2b0e726630 in ???
    at ?:-1
 7  0x0000000000439269 in runtime.crash
    at /usr/local/golang/go/src/runtime/signal_unix.go:944
 8  0x0000000000439269 in runtime.fatalpanic
    at /usr/local/golang/go/src/runtime/panic.go:1092
 9  0x0000000000438a37 in runtime.gopanic
    at /usr/local/golang/go/src/runtime/panic.go:941
10  0x000000000044e516 in runtime.panicmem
    at /usr/local/golang/go/src/runtime/panic.go:220
11  0x000000000044e516 in runtime.sigpanic
    at /usr/local/golang/go/src/runtime/signal_unix.go:818
12  0x00000000007215c0 in net/http.(*Transport).roundTrip
    at /usr/local/golang/go/src/net/http/transport.go:581
13  0x00000000007084f9 in net/http.(*Transport).RoundTrip
    at /usr/local/golang/go/src/net/http/roundtrip.go:17
14  0x00000000006c9e18 in net/http.send
    at /usr/local/golang/go/src/net/http/client.go:252
15  0x00000000006c96bb in net/http.(*Client).send
15  0x00000000006c96bb in net/http.(*Client).send
    at /usr/local/golang/go/src/net/http/client.go:176
16  0x00000000006cbaf5 in net/http.(*Client).do
    at /usr/local/golang/go/src/net/http/client.go:725
17  0x0000000000a14a57 in net/http.(*Client).Do
    at /usr/local/golang/go/src/net/http/client.go:593
18  0x0000000000a14a57 in github.com/go-kratos/kratos/v2/transport/http.(*Client).do
    at /usr/local/golang/gopath/pkg/mod/github.com/go-kratos/kratos/v2@v2.3.1/transport/http/client.go:288
19  0x0000000000a142f5 in github.com/go-kratos/kratos/v2/transport/http.(*Client).invoke.func1
    at /usr/local/golang/gopath/pkg/mod/github.com/go-kratos/kratos/v2@v2.3.1/transport/http/client.go:234
20  0x0000000000dd003b in git.17usoft.com/go/QOrderPreLoginSvr/pkg/middleware/logging.Client.func1.1
    at /home/centos/workspace/QOrderPreLoginSvr/pkg/middleware/logging/logging.go:96
21  0x0000000000a13fcd in github.com/go-kratos/kratos/v2/transport/http.(*Client).invoke
    at /usr/local/golang/gopath/pkg/mod/github.com/go-kratos/kratos/v2@v2.3.1/transport/http/client.go:253
22  0x0000000000a13cb5 in github.com/go-kratos/kratos/v2/transport/http.(*Client).Invoke
    at /usr/local/golang/gopath/pkg/mod/github.com/go-kratos/kratos/v2@v2.3.1/transport/http/client.go:229
23  0x0000000000a91acb in git.17usoft.com/go/QOrderPreLoginSvr/api/center/v1.(*CenterHTTPClientImpl).GetContactList
    at /home/centos/workspace/QOrderPreLoginSvr/api/center/v1/center_http.pb.go:137
24  0x0000000000ded447 in git.17usoft.com/go/QOrderPreLoginSvr/internal/data.(*PreLoginData).GetContactList
    at /home/centos/workspace/QOrderPreLoginSvr/internal/data/prelogin.go:637
25  0x0000000000ab34fd in git.17usoft.com/go/QOrderPreLoginSvr/internal/biz.(*PreLogin).getContactList
    at /home/centos/workspace/QOrderPreLoginSvr/internal/biz/prelogin.go:535
26  0x0000000000ab61b5 in git.17usoft.com/go/QOrderPreLoginSvr/internal/biz.(*PreLogin).ReportLogin.func1
    at /home/centos/workspace/QOrderPreLoginSvr/internal/biz/prelogin.go:773
27  0x0000000000468be1 in runtime.goexit
    at /usr/local/golang/go/src/runtime/asm_amd64.s:1571

(dlv) frame 12
> runtime.raise() /usr/local/golang/go/src/runtime/sys_linux_amd64.s:168 (PC: 0x46a541)
Warning: debugging optimized function
Frame 12: /usr/local/golang/go/src/net/http/transport.go:581 (PC: 7215c0)
(dlv) locals
ctx = context.Context(*context.valueCtx) 0xbeef000000000008
~R0.data = (unreadable empty OP stack)
~R0.itab = (unreadable empty OP stack)
trace = *net/http/httptrace.ClientTrace nil
scheme = "http"
isHTTP = true
origReq = ("*net/http.Request")(0xc005f28e00)
cancelKey = net/http.cancelKey {req: ("*net/http.Request")(0xc005f28e00)}
~R0 = (unreadable empty OP stack)
treq = ("*net/http.transportRequest")(0xc00668be40)
err = (unreadable could not read 8 bytes from register 3 (size: 0))
cm = net/http.connectMethod {_: net/http.incomparable [], proxyURL: *net/url.URL nil, targetScheme: "http",...+2 more}
```