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

Closed
aclements opened this issue Jul 19, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@aclements
Copy link
Member

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:

2017-06-25T15:57:18-b4dd1d9/linux-amd64-race
2017-07-10T20:09:00-6f83b75/linux-amd64-race
2017-07-15T20:44:10-0b62ebf/linux-amd64-race
2017-07-15T20:49:42-7390d2f/linux-amd64-race

And just appeared on a trybot: https://go-review.googlesource.com/c/50030/

@aclements aclements added the Testing label Jul 19, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

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

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

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.

@josharian

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2017

@bradfitz

This comment has been minimized.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 8, 2017

Change https://golang.org/cl/82795 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.
You can’t perform that action at this time.