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

net: data race with uninstallTestHooks #21090

aclements opened this issue Jul 19, 2017 · 5 comments

net: data race with uninstallTestHooks #21090

aclements opened this issue Jul 19, 2017 · 5 comments


Copy link

@aclements aclements commented Jul 19, 2017

A race between net.uninstallTestHooks and internal/poll.(*FD).destroy() on linux-amd64-race has appeared on the dashboard a few times:


And just appeared on a trybot:

@aclements aclements added the Testing label Jul 19, 2017
Copy link

@bradfitz bradfitz commented Jul 19, 2017

@bradfitz bradfitz added the NeedsFix label Jul 19, 2017
@bradfitz bradfitz added this to the Go1.10 milestone Jul 19, 2017
Copy link

@ianlancetaylor ianlancetaylor commented Jul 19, 2017

Seems like the problem is that a cancelled DNS lookup can leave behind a goroutine that has a deferred close of a DNS connection (the defer c.Close() in (*Resolver).exchange). There is no synchronization between that deferred close and the call to uninstallTestHooks in TestMain. uninstallTestHooks changes poll.CloseFunc, which is called when closing a connection. Ideally we should wait for all goroutines to complete before uninstalling the test hook, but at present there is no obvious way to do that.

Copy link

@gopherbot gopherbot commented Dec 8, 2017

Change mentions this issue: net: avoid race on test hooks with DNS goroutines

@gopherbot gopherbot closed this in 6c877e5 Dec 8, 2017
@golang golang locked and limited conversation to collaborators Dec 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants