From a46d8ac18de8a2c2b828f74941cf64b7b4647557 Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Sat, 24 Aug 2019 20:27:58 +0200 Subject: [PATCH] increase event handling buffer this should mitigate a timing issue where joining larger clusters would cause cluster.members() to deadlock. --- cluster.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index 263947a..e2435bf 100644 --- a/cluster.go +++ b/cluster.go @@ -101,8 +101,10 @@ func newCluster(config *config, wg *wgState) (*cluster, error) { localName: ml.LocalNode().Name, ml: ml, wg: wg, - events: make(chan memberlist.NodeEvent, 1), - state: state, + // The big channel buffer is a work-around for https://github.com/hashicorp/memberlist/issues/23 + // More than this many simultaneous events will deadlock cluster.members() + events: make(chan memberlist.NodeEvent, 100), + state: state, } mlConfig.Conflict = &cluster mlConfig.Events = &memberlist.ChannelEventDelegate{Ch: cluster.events}