[lxc-devel] [lxd/master] tests: Avoid event forwarding race condition

stgraber on Github lxc-bot at linuxcontainers.org
Tue Jul 23 23:26:20 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 952 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190723/b06c9c8d/attachment.bin>
-------------- next part --------------
From 6037c698f6a1e06bc7896ee55c50da9c9be01aa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 23 Jul 2019 19:20:42 -0400
Subject: [PATCH] tests: Avoid event forwarding race condition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

There is a tiny potential race right between a cluster node joins and
the event forwarding being functional. If we immediately get requested
to do cross-node activity (in this case importing an image and creating
a container from it), there is a chance that one or multiple events
won't make it, leading to the client tool hanging (waiting for an event).

This problem should disappear when we rework event distribution to move
away from the current broadcast approach, at which point we can have
individual LXD nodes refuse to serve requests until they are connected
to the event hub.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 test/suites/clustering.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/suites/clustering.sh b/test/suites/clustering.sh
index 5754e10152..659d96b066 100644
--- a/test/suites/clustering.sh
+++ b/test/suites/clustering.sh
@@ -831,6 +831,9 @@ test_clustering_publish() {
   ns2="${prefix}2"
   spawn_lxd_and_join_cluster "${ns2}" "${bridge}" "${cert}" 2 1 "${LXD_TWO_DIR}"
 
+  # Give LXD a couple of seconds to get event API connected properly
+  sleep 2
+
   # Init a container on node2, using a client connected to node1
   LXD_DIR="${LXD_TWO_DIR}" ensure_import_testimage
   LXD_DIR="${LXD_ONE_DIR}" lxc init --target node2 testimage foo


More information about the lxc-devel mailing list