From a436d4d32a68b2c25532c9d2aa8d109745fefcb7 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Wed, 9 May 2018 15:00:39 -0500 Subject: [PATCH] fixed deadlock in setcooridnator --- cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index b02bd50d2..8e342024e 100644 --- a/cluster.go +++ b/cluster.go @@ -307,16 +307,16 @@ func (c *Cluster) isCoordinator() bool { // nodes with its version of Cluster.Status. func (c *Cluster) SetCoordinator(n *Node) error { c.mu.Lock() - defer c.mu.Unlock() // Verify that the new Coordinator value matches // this node. if c.Node.ID != n.ID { + c.mu.Unlock() return fmt.Errorf("coordinator node does not match this node") } // Update IsCoordinator on all nodes (locally). _ = c.updateCoordinator(n) - + c.mu.Unlock() // Send the update coordinator message to all nodes. err := c.Broadcaster.SendSync( &internal.UpdateCoordinatorMessage{