Merge pull request #1754 from vikaschoudhary16/add-timeout

Add timeout while waiting for StartTransinetUnit completion signal
This commit is contained in:
Qiang Huang 2018-03-08 09:09:34 +08:00 committed by GitHub
commit 9facb87f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import (
"github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/cgroups/fs" "github.com/opencontainers/runc/libcontainer/cgroups/fs"
"github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/configs"
"github.com/sirupsen/logrus"
) )
type Manager struct { type Manager struct {
@ -300,7 +301,11 @@ func (m *Manager) Apply(pid int) error {
return err return err
} }
<-statusChan select {
case <-statusChan:
case <-time.After(time.Second):
logrus.Warnf("Timed out while waiting for StartTransientUnit completion signal from dbus. Continuing...")
}
if err := joinCgroups(c, pid); err != nil { if err := joinCgroups(c, pid); err != nil {
return err return err