moby/libcontainerd/supervisor
Cory Snider c12bbf549b
libcontainerd/supervisor: fix data race
The monitorDaemon() goroutine calls startContainerd() then blocks on
<-daemonWaitCh to wait for it to exit. The startContainerd() function
would (re)initialize the daemonWaitCh so a restarted containerd could be
waited on. This implementation was race-free because startContainerd()
would synchronously initialize the daemonWaitCh before returning. When
the call to start the managed containerd process was moved into the
waiter goroutine, the code to initialize the daemonWaitCh struct field
was also moved into the goroutine. This introduced a race condition.

Move the daemonWaitCh initialization to guarantee that it happens before
the startContainerd() call returns.

Signed-off-by: Cory Snider <csnider@mirantis.com>
(cherry picked from commit dd20bf4862)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-02-03 11:40:54 +01:00
..
remote_daemon.go libcontainerd/supervisor: fix data race 2024-02-03 11:40:54 +01:00
remote_daemon_linux.go libcontainerd/supervisor: explicitly ignore process kill errors 2023-08-14 14:02:27 +02:00
remote_daemon_options.go migrate to github.com/containerd/log v0.1.0 2023-10-11 17:52:23 +02:00
remote_daemon_windows.go libcontainerd/supervisor: explicitly ignore process kill errors 2023-08-14 14:02:27 +02:00
utils_linux.go libcontainerd: split client and supervisor 2018-08-06 10:23:04 -07:00
utils_windows.go libcontainerd: split client and supervisor 2018-08-06 10:23:04 -07:00