Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tun/netstack goroutine leaks #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kshangx
Copy link

@kshangx kshangx commented Feb 23, 2024

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()

Signed-off-by: kshangx <[email protected]>
pinkisemils pushed a commit to mullvad/wireguard-go that referenced this pull request Jul 17, 2024
The upstream netstack's virtual tunnel device has a leaky Close
implementation - the virtual network is not being shut down properly.
What's missing is this one line change to shut down all the go routines
associated with the userspace networking stack. This change is verbatim
copied from kshangx's PR - WireGuard/wireguard-go#101

Signed-off-by: kshangx <[email protected]>
@pronebird
Copy link

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

AlgirdasPundzius pushed a commit to ProtonVPN/wireguard-go that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants