Skip to content

Commit c6c5d6b

Browse files
committed
cgroups: Backport of upstream fixes around starting units
opencontainers/runc#1683 opencontainers/runc#1754 opencontainers/runc#1772 opencontainers/runc#1781 Signed-off-by: Mrunal Patel <[email protected]>
1 parent e3761ea commit c6c5d6b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

libcontainer/cgroups/systemd/apply_systemd.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import (
1010
"path/filepath"
1111
"strings"
1212
"sync"
13+
"time"
1314

15+
"github.com/Sirupsen/logrus"
1416
systemdDbus "github.com/coreos/go-systemd/dbus"
1517
systemdUtil "github.com/coreos/go-systemd/util"
1618
"github.com/godbus/dbus"
@@ -176,11 +178,16 @@ func (m *Manager) Apply(pid int) error {
176178
return err
177179
}
178180

179-
statusChan := make(chan string)
180-
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err != nil && !isUnitExists(err) {
181+
statusChan := make(chan string, 1)
182+
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err == nil {
183+
select {
184+
case <-statusChan:
185+
case <-time.After(time.Second):
186+
logrus.Warnf("Timed out while waiting for StartTransientUnit(%s) completion signal from dbus. Continuing...", unitName)
187+
}
188+
} else if !isUnitExists(err) {
181189
return err
182190
}
183-
<-statusChan
184191

185192
if err := joinCgroups(c, pid); err != nil {
186193
return err

0 commit comments

Comments
 (0)