summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-06 22:00:32 +0200
committerGitHub <noreply@github.com>2020-05-06 22:00:32 +0200
commit062c7b8a9411b7d115f85c2df58aeea760b001bc (patch)
treed4bf52857b24b7ed9f0c083e209f324fdb7a2346
parentab67664d3433c0e74f955263ab758416362f1801 (diff)
parentad27532b6c9c657c7aecaca4bcccb5baa6576839 (diff)
downloadpodman-062c7b8a9411b7d115f85c2df58aeea760b001bc.tar.gz
podman-062c7b8a9411b7d115f85c2df58aeea760b001bc.tar.bz2
podman-062c7b8a9411b7d115f85c2df58aeea760b001bc.zip
Merge pull request #6091 from rhatdan/v2
Eliminate race condition on podman info
-rw-r--r--libpod/info.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpod/info.go b/libpod/info.go
index d7ed5bb16..4007e0ce7 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -198,9 +198,15 @@ func (r *Runtime) getContainerStoreInfo() (define.ContainerStore, error) {
if err != nil {
return cs, err
}
+ cs.Number = len(cons)
for _, con := range cons {
state, err := con.State()
if err != nil {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
+ // container was probably removed
+ cs.Number--
+ continue
+ }
return cs, err
}
switch state {
@@ -212,7 +218,6 @@ func (r *Runtime) getContainerStoreInfo() (define.ContainerStore, error) {
stopped += 1
}
}
- cs.Number = len(cons)
cs.Paused = paused
cs.Stopped = stopped
cs.Running = running