Skip to content

indefinite blocking if handshaking tls under unconnected network #1366

@jayantxie

Description

@jayantxie

Describe the bug

goroutine 138 [IO wait]:
runtime.gopark(0x1f82f58, 0x7fededc8a4a0, 0x2, 0x1b, 0x5)
	/usr/local/go-versions/1.19/go/src/runtime/proc.go:365 +0xfd fp=0xc001148848 sp=0xc001148818 pc=0x44f25d
runtime.netpollblock(0x7fededc8a488, 0x72, 0x0)
	/usr/local/go-versions/1.19/go/src/runtime/netpoll.go:530 +0xca fp=0xc001148880 sp=0xc001148848 pc=0x446a0a
internal/poll.runtime_pollWait(0x200fb80?, 0x72)
	/usr/local/go-versions/1.19/go/src/runtime/netpoll.go:305 +0x45 fp=0xc0011488a8 sp=0xc001148880 pc=0x47d7a5
internal/poll.(*pollDesc).wait(0xc00054e398, 0x72, 0x0)
	/usr/local/go-versions/1.19/go/src/internal/poll/fd_poll_runtime.go:84 +0x88 fp=0xc0011488f8 sp=0xc0011488a8 pc=0x4e3828
internal/poll.(*pollDesc).waitRead(0xc00054e398, 0x0)
	/usr/local/go-versions/1.19/go/src/internal/poll/fd_poll_runtime.go:89 +0x37 fp=0xc001148940 sp=0xc0011488f8 pc=0x4e38d7
internal/poll.(*FD).Read(0xc00054e380, {0xc00148a6c0, 0x240, 0x240})
	/usr/local/go-versions/1.19/go/src/internal/poll/fd_unix.go:167 +0x44f fp=0xc001148aa0 sp=0xc001148940 pc=0x4e54ef
net.(*netFD).Read(0xc00054e380, {0xc00148a6c0, 0x240, 0x240})
	/usr/local/go-versions/1.19/go/src/net/fd_posix.go:55 +0x73 fp=0xc001148b18 sp=0xc001148aa0 pc=0x6e8d13
net.(*conn).Read(0xc0003dc078, {0xc00148a6c0, 0x240, 0x240})
	/usr/local/go-versions/1.19/go/src/net/net.go:183 +0xa9 fp=0xc001148bb0 sp=0xc001148b18 pc=0x70c589
crypto/tls.(*atLeastReader).Read(0xc0002d86d8, {0xc00148a6c0, 0x240, 0x240})
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:787 +0xc2 fp=0xc001148c30 sp=0xc001148bb0 pc=0xa27862
bytes.(*Buffer).ReadFrom(0xc000e96278, {0x200b740, 0xc0002d86d8})
	/usr/local/go-versions/1.19/go/src/bytes/buffer.go:202 +0x142 fp=0xc001148ce8 sp=0xc001148c30 pc=0x57bf22
crypto/tls.(*Conn).readFromUntil(0xc000e96000, {0x200e1e0, 0xc0003dc078}, 0x5)
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:809 +0x16f fp=0xc001148d80 sp=0xc001148ce8 pc=0xa27b8f
crypto/tls.(*Conn).readRecordOrCCS(0xc000e96000, 0x0)
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:616 +0x1d5 fp=0xc001149168 sp=0xc001148d80 pc=0xa25a35
crypto/tls.(*Conn).readRecord(0xc000e96000)
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:582 +0x2b fp=0xc0011491a8 sp=0xc001149168 pc=0xa257ab
crypto/tls.(*Conn).readHandshake(0xc000e96000, {0x0, 0x0})
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:1038 +0x8c fp=0xc001149400 sp=0xc0011491a8 pc=0xa2998c
crypto/tls.(*Conn).clientHandshake(0xc000e96000, {0x20161c8, 0xc00034c480})
	/usr/local/go-versions/1.19/go/src/crypto/tls/handshake_client.go:190 +0x530 fp=0xc001149720 sp=0xc001149400 pc=0xa2fdf0
crypto/tls.(*Conn).clientHandshake-fm({0x20161c8, 0xc00034c480})
	<autogenerated>:1 +0x4a fp=0xc001149770 sp=0xc001149720 pc=0xa713aa
crypto/tls.(*Conn).handshakeContext(0xc000e96000, {0x2016200, 0xc00003e108})
/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:1495 +0x525 fp=0xc0011499b0 sp=0xc001149770 pc=0xa2d2e5
crypto/tls.(*Conn).HandshakeContext(0xc000e96000, {0x2016200, 0xc00003e108})
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:1438 +0x3d fp=0xc0011499f8 sp=0xc0011499b0 pc=0xa2cd5d
crypto/tls.(*Conn).Handshake(0xc000e96000)
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:1422 +0x48 fp=0xc001149a50 sp=0xc0011499f8 pc=0xa2cce8
crypto/tls.(*Conn).Write(0xc000e96000, {0xc000ea0000, 0xf8, 0x1000})
	/usr/local/go-versions/1.19/go/src/crypto/tls/conn.go:1146 +0x19c fp=0xc001149c88 sp=0xc001149a50 pc=0xa2a7fc
[github.com/cloudwego/hertz/pkg/network/standard.(*Conn).Flush(0xc000368190)](http://github.com/cloudwego/hertz/pkg/network/standard.(*Conn).Flush(0xc000368190))
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/network/standard/connection.go:539](http://github.com/cloudwego/hertz@v0.9.5/pkg/network/standard/connection.go:539) +0x237 fp=0xc001149d58 sp=0xc001149c88 pc=0x1952b17
[github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).doNonNilReqResp](http://github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).doNonNilReqResp)(0xc000f6e300, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:595](http://github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:595) +0x77c fp=0xc00114a188 sp=0xc001149d58 pc=0x196893c
[github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).do](http://github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).do)(0xc000f6e300, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:461](http://github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:461) +0x6f fp=0xc00114a1e8 sp=0xc00114a188 pc=0x1967e2f
[github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).Do](http://github.com/cloudwego/hertz/pkg/protocol/http1.(*HostClient).Do)(0xc000f6e300, {0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:396](http://github.com/cloudwego/hertz@v0.9.5/pkg/protocol/http1/client.go:396) +0x205 fp=0xc00114a310 sp=0xc00114a1e8 pc=0x1967945
[github.com/cloudwego/hertz/pkg/app/client.(*Client).do](http://github.com/cloudwego/hertz/pkg/app/client.(*Client).do)(0xc00028d310, {0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/app/client/client.go:538](http://github.com/cloudwego/hertz@v0.9.5/pkg/app/client/client.go:538) +0x8ed fp=0xc00114a500 sp=0xc00114a310 pc=0x1971c8d
[github.com/cloudwego/hertz/pkg/app/client.(*Client).do-fm](http://github.com/cloudwego/hertz/pkg/app/client.(*Client).do-fm)({0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0)
	<autogenerated>:1 +0x6a fp=0xc00114a560 sp=0xc00114a500 pc=0x197376a
[ithub.com/hertz-contrib/localsession/client.CtxRecover.func1.1](http://ithub.com/hertz-contrib/localsession/client.CtxRecover.func1.1)({0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/hertz-contrib/localsession@v0.1.0/client/localsession.go:33](http://github.com/hertz-contrib/localsession@v0.1.0/client/localsession.go:33) +0xf0 fp=0xc00114abf0 sp=0xc00114ab80 pc=0x19b1070
[github.com/cloudwego/hertz/pkg/app/client.(*Client).Do](http://github.com/cloudwego/hertz/pkg/app/client.(*Client).Do)(0xc00028d310, {0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0)
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/app/client/client.go:464](http://github.com/cloudwego/hertz@v0.9.5/pkg/app/client/client.go:464) +0x1e5 fp=0xc00114ac70 sp=0xc00114abf0 pc=0x19712e5
[github.com/cloudwego/hertz/pkg/protocol/client.DoTimeout](http://github.com/cloudwego/hertz/pkg/protocol/client.DoTimeout)({0x2016200, 0xc00003e108}, 0xc00017ea80, 0xc00024b1e0, 0xb2d05e00, {0x200b500, 0xc00028b7a0})
	/home/byteide/go/pkg/mod/[github.com/cloudwego/hertz@v0.9.5/pkg/protocol/client/client.go:277](http://github.com/cloudwego/hertz@v0.9.5/pkg/protocol/client/client.go:277) +0x126 fp=0xc00114acf8 sp=0xc00114ac70 pc=0x19575a6

Expected behavior

Timeout if calling by DoTimeout(xx, 3 * time.Second).

Screenshots

If applicable, add screenshots to help explain your problem.

Hertz version:

v1.10.0

Environment:

The output of go env.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions