]> git.ipfire.org Git - thirdparty/lxc.git/commit
commands: fix race when open()/close() cmd socket
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Dec 2017 19:57:15 +0000 (20:57 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Dec 2017 12:51:28 +0000 (13:51 +0100)
commit32ee3fc3a369089ed1d0c4b943cdecf8c69c85c7
tree5637ff6414174425714b31c054a0d3b1f1fc9246
parentf14bc2497df7e7cc4603299f5d470e894f76504d
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