moby/libcontainerd
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
..
local libcontainerd/windows: Don't reap on failure 2023-09-18 12:28:03 +02:00
queue bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
remote daemon: stop setting container resources to zero 2023-06-21 22:16:22 +02:00
shimopts daemon: allow shimv2 runtimes to be configured 2023-02-17 18:08:06 -05:00
supervisor libcontainerd/supervisor: fix data race 2024-02-03 11:41:08 +01:00
types daemon: stop setting container resources to zero 2023-06-21 22:16:22 +02:00
libcontainerd_linux.go Configure shims from runtime config 2020-07-13 14:18:02 -07:00
libcontainerd_windows.go Remove unused useShimV2() 2020-07-15 14:28:48 +02:00
replace.go Share logic to create-or-replace a container 2022-08-24 14:59:08 -04:00