Skip to content

x/net: data race in trace package #60619

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

Open
ash2k opened this issue Jun 6, 2023 · 2 comments
Open

x/net: data race in trace package #60619

ash2k opened this issue Jun 6, 2023 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ash2k
Copy link
Contributor

ash2k commented Jun 6, 2023

From https://github.com/golang/net/blob/10cf388024ca83e11a073bb365ccda2b2806d103/trace/events.go#L61-L66:

	data.Families = make([]string, 0, len(families))
	famMu.RLock()
	for name := range families {
		data.Families = append(data.Families, name)
	}
	famMu.RUnlock()

Shouldn't len(families) be done with the mutex held? It's a package-level field that seem to be protected by the mutex.

@gopherbot gopherbot added this to the Unreleased milestone Jun 6, 2023
@dr2chase
Copy link
Contributor

dr2chase commented Jun 6, 2023

@neild @ianlancetaylor

I don't think this is necessarily an issue, if the pre-allocation merely has to be mostly-right, since append will grow the slice if the capacity is too small.

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants
@ash2k @dr2chase @gopherbot and others