Skip to content

runtime: Deadlock while writing to UDP socket when laptop goes to sleep  #61555

@nbrownus

Description

@nbrownus

What version of Go are you using (go version)?

$ go version
go version go1.20.4 darwin/arm64

Does this issue reproduce with the latest release?

Have not tried yet, difficult to reproduce reliably.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOOS="darwin"
GOARCH=arm64
CGO_ENABLED="0"

What did you do?

Ran nebula, put laptop to sleep, came back after a while and woke laptop, goroutine handling UDP writes was hung.

What did you expect to see?

UDP writes happening as expected

What did you see instead?

We have had a few instances of this and I am not sure where else to look. Sending SIGQUIT to the process, they all appear to have a goroutine blocked in the same way.

goroutine 36 [IO wait, 352 minutes]:
runtime.gopark(0x140003a9238?, 0x102fd3198?, 0x38?, 0x92?, 0x102fd345c?)
	runtime/proc.go:381 +0xe4 fp=0x140003a9200 sp=0x140003a91e0 pc=0x102f35e24
runtime.netpollblock(0x140003a9298?, 0x2fd3d48?, 0x1?)
	runtime/netpoll.go:527 +0x158 fp=0x140003a9240 sp=0x140003a9200 pc=0x102f2f2c8
internal/poll.runtime_pollWait(0x10b178e00, 0x77)
	runtime/netpoll.go:306 +0xa0 fp=0x140003a9270 sp=0x140003a9240 pc=0x102f616c0
internal/poll.(*pollDesc).wait(0x140002aa000?, 0x1400018ec60?, 0x0)
	internal/poll/fd_poll_runtime.go:84 +0x28 fp=0x140003a92a0 sp=0x140003a9270 pc=0x102fd0498
internal/poll.(*pollDesc).waitWrite(...)
	internal/poll/fd_poll_runtime.go:93
internal/poll.(*FD).WriteToInet6(0x140002aa000, {0x1400018ec60, 0x101, 0x120}, 0x0?)
	internal/poll/fd_unix.go:479 +0x1dc fp=0x140003a9340 sp=0x140003a92a0 pc=0x102fd3ddc
net.(*netFD).writeToInet6(0x140002aa000, {0x1400018ec60?, 0xffff000000000000?, 0xdf278303?}, 0x0?)
	net/fd_posix.go:114 +0x28 fp=0x140003a9390 sp=0x140003a9340 pc=0x1030539d8
net.(*UDPConn).writeTo(0x140002a8018, {0x1400018ec60, 0x101, 0x120}, 0x30?)
	net/udpsock_posix.go:133 +0xec fp=0x140003a94d0 sp=0x140003a9390 pc=0x10306d1bc
net.(*UDPConn).WriteToUDP(0x140002a8018, {0x1400018ec60?, 0x140003a9608?, 0x5?}, 0x14000336930)
	net/udpsock.go:215 +0x30 fp=0x140003a9520 sp=0x140003a94d0 pc=0x10306b8b0
github.com/slackhq/nebula/udp.(*Conn).WriteTo(...)
	github.com/slackhq/nebula/udp/udp_generic.go:39
github.com/slackhq/nebula.(*HandshakeManager).handleOutbound.func1(0x140000ca120, 0x0?)
	github.com/slackhq/nebula/handshake_manager.go:173 +0x138 fp=0x140003a9b20 sp=0x140003a9520 pc=0x1034180c8
github.com/slackhq/nebula.(*RemoteList).ForEach(0x140002aa200, {0x0?, 0x0, 0x140000b2048?}, 0x140003a9f18)
	github.com/slackhq/nebula/remote_list.go:248 +0xd0 fp=0x140003a9ba0 sp=0x140003a9b20 pc=0x103440de0
github.com/slackhq/nebula.(*HandshakeManager).handleOutbound(0x140002ba000, 0xa80050d, {0x1036e8c18, 0x140002ac7e0}, 0x0)
	github.com/slackhq/nebula/handshake_manager.go:171 +0x260 fp=0x140003abe90 sp=0x140003a9ba0 pc=0x103415ff0
github.com/slackhq/nebula.(*HandshakeManager).NextOutboundHandshakeTimerTick(0x140002ba000, {0x140003abf14?, 0x1036e8c18?, 0x103aef1c0?}, {0x1036e8c18, 0x140002ac7e0})
	github.com/slackhq/nebula/handshake_manager.go:99 +0x70 fp=0x140003abed0 sp=0x140003abe90 pc=0x103415d30
github.com/slackhq/nebula.(*HandshakeManager).Run(0x140002ba000, {0x1036e8978, 0x14000036190}, {0x1036e8c18, 0x140002ac7e0})
	github.com/slackhq/nebula/handshake_manager.go:87 +0x11c fp=0x140003abf90 sp=0x140003abed0 pc=0x103415bfc
github.com/slackhq/nebula.Main.func4()
	github.com/slackhq/nebula/main.go:323 +0x38 fp=0x140003abfd0 sp=0x140003abf90 pc=0x10342f278
runtime.goexit()
	runtime/asm_arm64.s:1172 +0x4 fp=0x140003abfd0 sp=0x140003abfd0 pc=0x102f67bb4
created by github.com/slackhq/nebula.Main
	github.com/slackhq/nebula/main.go:323 +0x1ee8

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions