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

Bug Report: data race in IsFlagProvided function. #12041

Closed
GuptaManan100 opened this issue Jan 5, 2023 · 0 comments · Fixed by #12042
Closed

Bug Report: data race in IsFlagProvided function. #12041

GuptaManan100 opened this issue Jan 5, 2023 · 0 comments · Fixed by #12042

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

The IsFlagProvided function introduced in #11881 seems to be running into a data race.

The reason is that Visit function is uses isn’t thread-safe -

if len(f.actual) != len(f.sortedActual) {
	f.sortedActual = sortFlags(f.actual)
}
flags = f.sortedActual

So if two go-routines call this same function, one can be reading sortedActual in line 1 and the other could be writing to it in the next line.

Reproduction Steps

Run unit_race over and over until this fails.

Binary Version

main

Operating System and Environment details

main

Log Fragments

No response

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

Successfully merging a pull request may close this issue.

1 participant