moby/libcontainerd
Cory Snider 36935bd869 libcontainerd: close stdin sync if possible
Closing stdin of a container or exec (a.k.a.: task or process) has been
somewhat broken ever since support for ContainerD 1.0 was introduced
back in Docker v17.11: the error returned from the CloseIO() call was
effectively ignored due to it being assigned to a local variable which
shadowed the intended variable. Serendipitously, that oversight
prevented a data race. In my recent refactor of libcontainerd, I
corrected the variable shadowing issue and introduced the aforementioned
data race in the process.

Avoid deadlocking when closing stdin without swallowing errors or
introducing data races by calling CloseIO() synchronously if the process
handle is available, falling back to an asynchronous close-and-log
strategy otherwise. This solution is inelegant and complex, but looks to
be the best that could be done without changing the libcontainerd API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-04-03 15:25:16 -04:00
..
local libc8d/local: set task id to container id 2023-01-31 17:02:43 -05:00
queue bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
remote libcontainerd: close stdin sync if possible 2023-04-03 15:25:16 -04:00
shimopts daemon: allow shimv2 runtimes to be configured 2023-02-17 18:08:06 -05:00
supervisor libcontainerd/supervisor: use pkg/pidfile for reading and writing pidfile 2022-11-04 01:50:26 +01:00
types vendor: github.com/containerd/cgroups/v3 v3.0.1 2023-03-08 20:15:17 +09: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