Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
ciao-launcher: Timeout ContainerStats
Browse files Browse the repository at this point in the history
The call to ContainerStats seems to be hanging on recent versions of
docker.  This commit times the call out after 5 seconds.

Signed-off-by: Mark Ryan <[email protected]>
  • Loading branch information
Mark Ryan committed Nov 16, 2016
1 parent c12608a commit e31c080
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ciao-launcher/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,9 @@ func (d *docker) stats() (disk, memory, cpu int) {
return
}

resp, err := d.cli.ContainerStats(context.Background(), d.dockerID, false)
ctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second)
resp, err := d.cli.ContainerStats(ctx, d.dockerID, false)
cancelFunc()
if err != nil {
glog.Errorf("Unable to get stats from container: %s:%s %v", d.cfg.Instance, d.dockerID, err)
return
Expand Down

0 comments on commit e31c080

Please sign in to comment.