]> git.ipfire.org Git - thirdparty/lxc.git/commit
commands: fix race when open()/close() cmd socket 2039/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Dec 2017 19:57:15 +0000 (20:57 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Dec 2017 19:57:15 +0000 (20:57 +0100)
commitf893d898079004d198064337a4879bce5b28c9d8
tree781e45c5fca3a70c675aa5884b6c3c47f5192a32
parent45acc1bd8c890da50cccbd18140a1b56354496be
commands: fix race when open()/close() cmd socket

When we report STOPPED to a caller and then close the command socket it is
technically possible - and I've seen this happen on the test builders - that a
container start() right after a wait() will receive ECONNREFUSED because it
called open() before we close(). So for all new state clients simply close the
command socket. This will inform all state clients that the container is
STOPPED and also prevents a race between a open()/close() on the command socket
causing a new process to get ECONNREFUSED because we haven't yet closed the
command socket.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c