浏览代码

Merge pull request #47300 from corhere/libc8d/fix-startup-data-race

libcontainerd/supervisor: fix data race
Brian Goff 1 年之前
父节点
当前提交
e240ba44b7
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      libcontainerd/supervisor/remote_daemon.go

+ 3 - 2
libcontainerd/supervisor/remote_daemon.go

@@ -190,12 +190,13 @@ func (r *remote) startContainerd() error {
 		runtime.LockOSThread()
 		defer runtime.UnlockOSThread()
 		err := cmd.Start()
-		startedCh <- err
 		if err != nil {
+			startedCh <- err
 			return
 		}
-
 		r.daemonWaitCh = make(chan struct{})
+		startedCh <- nil
+
 		// Reap our child when needed
 		if err := cmd.Wait(); err != nil {
 			r.logger.WithError(err).Errorf("containerd did not exit successfully")