wireguard-go icon indicating copy to clipboard operation
wireguard-go copied to clipboard

tun/netstack goroutine leaks

Open kshangx opened this issue 1 year ago • 1 comments

Issue

netstack is not properly closed, causing goroutine leaks.

goroutine profile: total 123
108 @ 0x439d16 0xe27ea5 0xe27e8d 0xe27fb1 0xe44d70 0xe44d61 0x46cd21
#	0xe27ea4	gvisor.dev/gvisor/pkg/sync.Gopark+0x84					/go/src/.../vendor/gvisor.dev/gvisor/pkg/sync/runtime_unsafe.go:41
#	0xe27e8c	gvisor.dev/gvisor/pkg/sleep.(*Sleeper).nextWaker+0x6c			/go/src/.../vendor/gvisor.dev/gvisor/pkg/sleep/sleep_unsafe.go:209
#	0xe27fb0	gvisor.dev/gvisor/pkg/sleep.(*Sleeper).fetch+0x30			/go/src/.../vendor/gvisor.dev/gvisor/pkg/sleep/sleep_unsafe.go:256
#	0xe44d6f	gvisor.dev/gvisor/pkg/sleep.(*Sleeper).Fetch+0xaf			/go/src/.../vendor/gvisor.dev/gvisor/pkg/sleep/sleep_unsafe.go:279
#	0xe44d60	gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*processor).start+0xa0	/go/src/.../vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/dispatcher.go:287

Fix

Close netstack in netTun.Close()

kshangx avatar Feb 23 '24 01:02 kshangx

@zx2c4 could you please look into merging this PR? Thanks.

pronebird avatar Aug 11 '24 07:08 pronebird

Sorry for the delay. Applied.

zx2c4 avatar May 04 '25 16:05 zx2c4