Currently the EOF that the server gets when a client connection is
closed is being ignored, which means that the goroutine that is
processing the client connection will never exit. If it never exits
it will never close the underlying unix socket and this would lead
to a file descriptor leak.
# create a long running task
ctr image pull docker.io/library/alpine:latest
ctr run --rm docker.io/library/alpine:latest test sleep 9999
# count number of open sockets
ls -la /proc/$(pidof containerd-shim)/fd | grep socket | wc -l
2
# restart containerd to make it reconnect to the shim
kill $(pidof containerd)
containerd &
# observe that socket number increased. It increases by 1 with every containerd restart
ls -la /proc/$(pidof containerd-shim)/fd | grep socket | wc -l
3
Currently the EOF that the server gets when a client connection is closed is being ignored, which means that the goroutine that is processing the client connection will never exit. If it never exits it will never close the underlying unix socket and this would lead to a file descriptor leak.
Signed-off-by: Georgi Sabev georgethebeatle@gmail.com
Reprodction steps: