From 04e95b526d41d0410e69995b42c67067495f5297 Mon Sep 17 00:00:00 2001 From: vikaschoudhary16 Date: Wed, 7 Mar 2018 00:31:41 -0500 Subject: [PATCH] Add timeout while waiting for StartTransinetUnit completion signal from dbus Signed-off-by: vikaschoudhary16 --- libcontainer/cgroups/systemd/apply_systemd.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcontainer/cgroups/systemd/apply_systemd.go b/libcontainer/cgroups/systemd/apply_systemd.go index b5cf33aa..efadc2a3 100644 --- a/libcontainer/cgroups/systemd/apply_systemd.go +++ b/libcontainer/cgroups/systemd/apply_systemd.go @@ -17,6 +17,7 @@ import ( "github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups/fs" "github.com/opencontainers/runc/libcontainer/configs" + "github.com/sirupsen/logrus" ) type Manager struct { @@ -300,7 +301,11 @@ func (m *Manager) Apply(pid int) error { 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 { return err