-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
WIP: Fix data race (Repository.Units) #8223
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
Conversation
2a73a72
to
904d90f
Compare
The current webhook just shows the amount of commits, but misses the actual commit description. While the code is actually there to include the description, it is just not included. Signed-off-by: Bjoern Petri <[email protected]>
904d90f
to
64e6bdb
Compare
These races may be caused by permission's Units. I think a simple method is to change // Permission contains all the permissions related variables to a repository for a user
type Permission struct {
AccessMode AccessMode
Units []*RepoUnit
UnitsMode map[UnitType]AccessMode
} |
@lunny As I understand, the races are due to the concurrent access to the slice header (the It would be better if this can be solved by an architectural change that avoids sharing the data in any way. But I don't have a clear picture of how to do it. |
Or we could copy the slices only but not change the slice element type. Permission's Unit is a reference of Repo.Units that has been changed by some other goroutines. I think that's the problem. |
Another way is to fix the upper-level code by avoiding sharing the objects in the first place. One implementation I tried is to deep-copy the I think there is a chance that we can pass the objects through the channels by value, not by pointers, to avoid sharing the memory. |
Please resolve conflicts |
@lunny I think this PR is not good. It touches too much code but does not address it fundamentally. We have to decide whether we want to make the |
For #8205 (comment), #8205 (comment), #8205 (comment).