1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix race in stats cli and native driver

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
Antonio Murdaca 2015-05-24 22:26:50 +02:00
parent 628c396555
commit 77280a87b7
2 changed files with 4 additions and 0 deletions

View file

@ -37,7 +37,9 @@ func (s *containerStats) Collect(cli *DockerCli, streamStats bool) {
}
stream, _, err := cli.call("GET", "/containers/"+s.Name+"/stats?"+v.Encode(), nil, nil)
if err != nil {
s.mu.Lock()
s.err = err
s.mu.Unlock()
return
}
defer stream.Close()

View file

@ -335,7 +335,9 @@ func (d *driver) Clean(id string) error {
}
func (d *driver) Stats(id string) (*execdriver.ResourceStats, error) {
d.Lock()
c := d.activeContainers[id]
d.Unlock()
if c == nil {
return nil, execdriver.ErrNotRunning
}