-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix some race conditions #123
Conversation
You can see the leaked goroutine in the test results;
|
I've removed the |
@@ -41,7 +41,7 @@ type StaticResponseMembersAPI struct { | |||
} | |||
|
|||
func (s *StaticResponseMembersAPI) List(ctx context.Context) ([]etcdclient.Member, error) { | |||
return s.parent.Members, nil | |||
return s.parent.Members[:], nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new slice doesn't copy the underlying members does it? So if you modified the Members themselves it would still mutate the old slice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I didn't bother, because I was concentrating on fixing the race conditions, but I've now added a deep copy function to avoid any accidental mutation of the Member list.
The controller-runtime
manager.Start
doesn't wait for all its go-routines to finish,which leads to another race when the controller runtime attempts to log (via t.Log) after a test has finished.
See:
Part of: #117