The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7139

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
The timeout was hit by Anbox in particularly loaded scenarios.

Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
From 4ff5c6aad4c7c4fa29354a5aad0988b14c692f7d Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanay...@canonical.com>
Date: Fri, 3 Apr 2020 15:48:05 +0100
Subject: [PATCH] Increase timeout when calling dqlite.Client.Add() to join the
 cluster

Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
---
 lxd/cluster/membership.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lxd/cluster/membership.go b/lxd/cluster/membership.go
index f3e6cba990..23590ff70e 100644
--- a/lxd/cluster/membership.go
+++ b/lxd/cluster/membership.go
@@ -341,7 +341,7 @@ func Join(state *state.State, gateway *Gateway, cert 
*shared.CertInfo, name stri
        logger.Info(
                "Joining dqlite raft cluster",
                log15.Ctx{"id": info.ID, "address": info.Address, "role": 
info.Role})
-       ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+       ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
        defer cancel()
        client, err := client.FindLeader(
                ctx, gateway.NodeStore(),
@@ -352,6 +352,9 @@ func Join(state *state.State, gateway *Gateway, cert 
*shared.CertInfo, name stri
                return errors.Wrap(err, "Failed to connect to cluster leader")
        }
        defer client.Close()
+
+       ctx, cancel = context.WithTimeout(context.Background(), time.Minute)
+       defer cancel()
        err = client.Add(ctx, *info)
        if err != nil {
                return errors.Wrap(err, "Failed to join cluster")
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to