moby/libcontainerd/remote
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
..
client.go libcontainerd: close stdin sync if possible 2023-04-03 15:25:16 -04:00
client_io_windows.go libcontainerd/remote: remove stray import comment 2022-12-08 13:27:50 +01:00
client_linux.go Refactor libcontainerd to minimize c8d RPCs 2022-08-24 14:59:08 -04:00
client_windows.go Refactor libcontainerd to minimize c8d RPCs 2022-08-24 14:59:08 -04:00