moby/libcontainerd/supervisor
Cory Snider d22068f8e3
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:41:08 +01:00
..
remote_daemon.go libcontainerd/supervisor: fix data race 2024-02-03 11:41:08 +01:00
remote_daemon_linux.go move pkg/system: process to a separate package 2022-11-04 01:50:23 +01:00
remote_daemon_options.go libcontainerd/supervisor: don't write log-level to config file 2022-08-11 14:11:06 +02:00
remote_daemon_options_linux.go daemon: deprecate --oom-score-adjust for the daemon 2023-04-13 00:02:39 +02:00
remote_daemon_windows.go move pkg/system: process to a separate package 2022-11-04 01:50:23 +01: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