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

xdsclient: fix race in load report implementation #5927

Merged
merged 1 commit into from Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion xds/internal/xdsclient/clientimpl_loadreport.go
Expand Up @@ -30,13 +30,15 @@ import (
func (c *clientImpl) ReportLoad(server *bootstrap.ServerConfig) (*load.Store, func()) {
c.authorityMu.Lock()
a, err := c.newAuthorityLocked(server)
c.authorityMu.Unlock()
if err != nil {
c.authorityMu.Unlock()
c.logger.Infof("xds: failed to connect to the control plane to do load reporting for authority %q: %v", server, err)
return nil, func() {}
}
// Hold the ref before starting load reporting.
a.refLocked()
c.authorityMu.Unlock()

store, cancelF := a.reportLoad()
return store, func() {
cancelF()
Expand Down