Skip to content

Commit

Permalink
cgroups: Backport of upstream fixes around starting units
Browse files Browse the repository at this point in the history
  • Loading branch information
mrunalp committed Jun 12, 2018
1 parent 18eb957 commit 0705375
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libcontainer/cgroups/systemd/apply_systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"path/filepath"
"strings"
"sync"
"time"

"github.com/Sirupsen/logrus"
systemdDbus "github.com/coreos/go-systemd/dbus"
systemdUtil "github.com/coreos/go-systemd/util"
"github.com/godbus/dbus"
Expand Down Expand Up @@ -176,11 +178,16 @@ func (m *Manager) Apply(pid int) error {
return err
}

statusChan := make(chan string)
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err != nil && !isUnitExists(err) {
statusChan := make(chan string, 1)
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err == nil {
select {
case <-statusChan:
case <-time.After(time.Second):
logrus.Warnf("Timed out while waiting for StartTransientUnit(%s) completion signal from dbus. Continuing...", unitName)
}
} else if !isUnitExists(err) {
return err
}
<-statusChan

if err := joinCgroups(c, pid); err != nil {
return err
Expand Down

0 comments on commit 0705375

Please sign in to comment.