Skip to content

net: call to Dial results in "all goroutines are asleep" #77277

Description

@mcwalrus

Go version

go1.25.6 playground

Output of go env in your module/workspace:

N/A - reproduce found in playground

What did you do?

Found deadlock race condition case with example test:

https://pkg.go.dev/context#example-AfterFunc-Connection

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x7ebd7704cc00, 0x77)
	/usr/local/go-faketime/src/runtime/netpoll.go:351 +0x85
internal/poll.(*pollDesc).wait(0xc0000f2180?, 0x516dde?, 0x0)
	/usr/local/go-faketime/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitWrite(...)
	/usr/local/go-faketime/src/internal/poll/fd_poll_runtime.go:93
internal/poll.(*FD).WaitWrite(...)
	/usr/local/go-faketime/src/internal/poll/fd_unix.go:685
net.(*netFD).connect(0xc0000f2180, {0x547fb0, 0x6218e0}, {0x4164f4?, 0x0?}, {0x547948?, 0xc0000b6100?})
	/usr/local/go-faketime/src/net/fd_unix.go:130 +0x6b6
net.(*netFD).dial(0xc0000f2180, {0x547fb0, 0x6218e0}, {0x5485b8?, 0x0?}, {0x5485b8, 0xc0000aa630}, 0x7ebd77325470?)
	/usr/local/go-faketime/src/net/sock_posix.go:124 +0x3bc
net.socket({0x547fb0, 0x6218e0}, {0x516dde, 0x3}, 0x2, 0x1, 0xc000002380?, 0x0, {0x5485b8, 0x0}, ...)
	/usr/local/go-faketime/src/net/sock_posix.go:70 +0x29b
net.internetSocket({0x547fb0, 0x6218e0}, {0x516dde, 0x3}, {0x5485b8, 0x0}, {0x5485b8, 0xc0000aa630}, 0x1, 0x0, ...)
	/usr/local/go-faketime/src/net/ipsock_posix.go:167 +0xf8
net.(*sysDialer).doDialTCPProto(0xc0000f8000, {0x547fb0, 0x6218e0}, 0x0, 0xc0000aa630, 0x0)
	/usr/local/go-faketime/src/net/tcpsock_posix.go:85 +0xe7
net.(*sysDialer).doDialTCP(...)
	/usr/local/go-faketime/src/net/tcpsock_posix.go:75
net.(*sysDialer).dialTCP(0x28?, {0x547fb0?, 0x6218e0?}, 0xc0000789f0?, 0x4cfa66?)
	/usr/local/go-faketime/src/net/tcpsock_posix.go:71 +0x69
net.(*sysDialer).dialSingle(0xc0000f8000, {0x547fb0, 0x6218e0}, {0x547e28, 0xc0000aa630})
	/usr/local/go-faketime/src/net/dial.go:721 +0x3ce
net.(*sysDialer).dialSerial(0xc0000f8000, {0x547fb0, 0x6218e0}, {0xc0000b4130?, 0x1, 0x1c?})
	/usr/local/go-faketime/src/net/dial.go:686 +0x248
net.(*sysDialer).dialParallel(0x0?, {0x547fb0?, 0x6218e0?}, {0xc0000b4130?, 0x4f6320?, 0x516e95?}, {0x0?, 0x516dde?, 0x7ebd7731a5c0?})
	/usr/local/go-faketime/src/net/dial.go:587 +0x30a
net.(*Dialer).DialContext(0xc000078d90, {0x547fb0, 0x6218e0}, {0x516dde, 0x3}, {0xc0000be140, 0xf})
	/usr/local/go-faketime/src/net/dial.go:578 +0x6a9
net.(*Dialer).Dial(...)
	/usr/local/go-faketime/src/net/dial.go:504
net.Dial({0x516dde?, 0x490013?}, {0xc0000be140?, 0x415b77?})
	/usr/local/go-faketime/src/net/dial.go:471 +0x77
main.main()
	/tmp/sandbox917687343/prog.go:35 +0x132

What did you see happen?

Occasional fatal error when trying example test.

What did you expect to see?

Examples from the standard library are expected to work.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions