Fix race in helm list when partitioning

Problem:
The chunks slice that is passed through the channel is reused for each
partition. This means that encoding the release into a message is racing with
populating the next partition, causing the results to sometimes not fit in the
message, and the release list to be incorrect

Solution:
Allocate a new slice for each partition

Issue #3322

Signed-off-by: Brian Marshall <bmarshall13@users.noreply.github.com>
pull/4608/head
Brian Marshall 6 years ago
parent 094b97ab5d
commit a0858e29d8

@ -140,7 +140,7 @@ func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*re
s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap)
chunks <- chunk
// reset paritioning state
chunk = chunk[:0]
chunk = nil
fill = 0
}
chunk = append(chunk, rls)

Loading…
Cancel
Save