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

Possible goroutine leak #47

Open
nlmackenzie opened this issue Aug 1, 2017 · 0 comments
Open

Possible goroutine leak #47

nlmackenzie opened this issue Aug 1, 2017 · 0 comments

Comments

@nlmackenzie
Copy link

In gatt.go/Connect, once Scan has been called, it looks as though incoming adverts will create goroutines that eventually call fn to pass the advert data to Dial via ch. If multiple adverts arrive quickly, Dial will process the first, but the remaining adverts will block in fn on the send to ch.
Similarly, if Scan terminates for any reason other than a cancel, then we don't reach Dial and an incoming advert could block when trying to send to ch.
These blocked sends could leak goroutines, so Connect should probably close ch before the two return paths exit, and fn could defer a call to recover, in order to handle any panics when a is sent to a ch that's been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant