Skip to content

Commit 96086e5

Browse files
authored
Merge pull request #1683 from vikaschoudhary16/runc-systemd-race
Fix race against systemd
2 parents e6516b3 + d5b4a3e commit 96086e5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libcontainer/cgroups/systemd/apply_systemd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,13 @@ func (m *Manager) Apply(pid int) error {
295295
}
296296
}
297297

298-
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, nil); err != nil && !isUnitExists(err) {
298+
statusChan := make(chan string)
299+
if _, err := theConn.StartTransientUnit(unitName, "replace", properties, statusChan); err != nil && !isUnitExists(err) {
299300
return err
300301
}
301302

303+
<-statusChan
304+
302305
if err := joinCgroups(c, pid); err != nil {
303306
return err
304307
}

0 commit comments

Comments
 (0)