Skip to content

Fix leaking goroutines in NAT pinger - #2160

Merged
soffokl merged 1 commit into
masterfrom
bugfix/pinger-goroutine-leak
May 4, 2020
Merged

Fix leaking goroutines in NAT pinger#2160
soffokl merged 1 commit into
masterfrom
bugfix/pinger-goroutine-leak

Conversation

@soffokl

@soffokl soffokl commented May 4, 2020

Copy link
Copy Markdown
Member

Closes #2159

@soffokl soffokl added the bug label May 4, 2020
@soffokl soffokl self-assigned this May 4, 2020
Comment thread nat/traversal/pinger.go

// waitMsg waits until conn receives given message or timeouts.
func waitMsg(ctx context.Context, conn *net.UDPConn, msg string) error {
ok := make(chan struct{})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this help to fix a leak?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not block on writing to channel when no one reads from the channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch here.

@soffokl
soffokl force-pushed the bugfix/pinger-goroutine-leak branch from b1489d9 to 2a96c61 Compare May 4, 2020 09:00
@soffokl
soffokl merged commit 5d4b128 into master May 4, 2020
@soffokl
soffokl deleted the bugfix/pinger-goroutine-leak branch May 4, 2020 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Goroutine leaks in the NAT Pinger

4 participants