mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-16 03:49:52 +00:00
fix MemcacheClient.FetchReports miss & leak on corrupt report
Problem: Decoding a corrupt report grows the 'missing' list. Since we are waiting for 'len(keys)-len(missing)' decoder go-routines, this results in waiting for fewer go-routines than we should. The surplus go-routines leak and we ignore their reports. And since the keys of the ignored reports are not included in 'missing', we won't attempt to fetch them from S3 either. Oops. Fix: calculate the number of go-routines once, at the beginning.
This commit is contained in:
@@ -186,7 +186,8 @@ func (c *MemcacheClient) FetchReports(keys []string) (map[string]report.Report,
|
||||
}
|
||||
|
||||
reports := map[string]report.Report{}
|
||||
for i := 0; i < len(keys)-len(missing); i++ {
|
||||
lenFound := len(keys) - len(missing)
|
||||
for i := 0; i < lenFound; i++ {
|
||||
r := <-ch
|
||||
if r.report == nil {
|
||||
missing = append(missing, r.key)
|
||||
|
||||
Reference in New Issue
Block a user