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

fix datarace in hv #1847

Merged
merged 1 commit into from
Jun 29, 2024
Merged
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
4 changes: 4 additions & 0 deletions pkg/visor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Hypervisor struct {
dmsgC *dmsg.Client
users *usermanager.UserManager
mu *sync.RWMutex
vsMu *sync.RWMutex
selfConn Conn
logger *logging.Logger
}
Expand Down Expand Up @@ -95,6 +96,7 @@ func NewHypervisor(config visorconfig.HypervisorConfig, visor *Visor, dmsgC *dms
dmsgC: dmsgC,
users: usermanager.NewUserManager(mLogger, singleUserDB, config.Cookies),
mu: new(sync.RWMutex),
vsMu: new(sync.RWMutex),
selfConn: selfConn,
logger: mLogger.PackageLogger("hypervisor"),
}
Expand Down Expand Up @@ -562,7 +564,9 @@ func (hv *Hypervisor) getAllVisorsSummary() http.HandlerFunc {
} else {
log.Trace("Obtained summary via RPC.")
resp := makeSummaryResp(err == nil, false, summary)
hv.vsMu.Lock()
summaries = append(summaries, resp)
hv.vsMu.Unlock()
}
wg.Done()
}(pk, c)
Expand Down
Loading