Merge pull request #22120 from crosbymichael/stats-panic

Create a copy of stats value before modifications
This commit is contained in:
Michael Crosby 2016-04-18 16:26:23 -07:00
commit eed9c930b8
2 changed files with 3 additions and 3 deletions

View file

@ -43,11 +43,11 @@ func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, c
var preCPUStats types.CPUStats
getStatJSON := func(v interface{}) *types.StatsJSON {
ss := v.(*types.StatsJSON)
ss := v.(types.StatsJSON)
ss.PreCPUStats = preCPUStats
// ss.MemoryStats.Limit = uint64(update.MemoryLimit)
preCPUStats = ss.CPUStats
return ss
return &ss
}
enc := json.NewEncoder(outStream)

View file

@ -135,7 +135,7 @@ func (s *statsCollector) run() {
// FIXME: move to containerd
stats.CPUStats.SystemUsage = systemUsage
pair.publisher.Publish(stats)
pair.publisher.Publish(*stats)
}
}
}