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

server: fix a race when reading server object #108371

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/server/server_controller_channel_orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ var _ serverState = (*serverStateUsingChannels)(nil)

// getServer is part of the serverState interface.
func (s *serverStateUsingChannels) getServer() (orchestratedServer, bool) {
return s.server, s.started.Get()
if s.started.Get() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems incorrect. It was already the case that the callers of this method should not consider the 1st return value if the 2nd was false.

you observing a difference means there are some callers that were not using the API properly. That is the bug we need to find and fix.

I have searched all the current callers of this, and I cannot see any one of them using the API incorrectly.

Can you share the steps you used to assert this is making a difference?

return s.server, true
}
return nil, false
}

// nameContainer is part of the serverState interface.
Expand Down