Explorar o código

Merge pull request #47314 from thaJeztah/24.0_backport_libc8d_fix_startup_data_race

[24.0 backport] libcontainerd/supervisor: fix data race
Sebastiaan van Stijn hai 1 ano
pai
achega
a9f4dd168e
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      libcontainerd/supervisor/remote_daemon.go

+ 3 - 2
libcontainerd/supervisor/remote_daemon.go

@@ -185,12 +185,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")