]> 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>
Sun, 17 Dec 2017 15:56:47 +0000 (16:56 +0100)
commit59beaa6f7b729d89f626e277334e8872fc455837
tree7953f7d9622b18eb98d612c3a494518c018f28f7
parent763656317b1a7089d5dda7e4ca9539e206fb7ee1
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