From f19ba411442d5dd53d806db7ebc57c95bbb28e82 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 10 Nov 2017 12:26:48 -0800 Subject: [PATCH] Moves the LAN event handler after the router is created. Fixes #3680 --- agent/consul/client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/agent/consul/client.go b/agent/consul/client.go index 4667807278..96baeb1748 100644 --- a/agent/consul/client.go +++ b/agent/consul/client.go @@ -131,10 +131,7 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) { shutdownCh: make(chan struct{}), } - // Start lan event handlers before lan Serf setup to prevent deadlock - go c.lanEventHandler() - - // Initialize the lan Serf + // Initialize the LAN Serf c.serf, err = c.setupSerf(config.SerfLANConfig, c.eventCh, serfLANSnapshot) if err != nil { @@ -146,6 +143,10 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) { c.routers = router.New(c.logger, c.shutdownCh, c.serf, c.connPool) go c.routers.Start() + // Start LAN event handlers after the router is complete since the event + // handlers depend on the router and the router depends on Serf. + go c.lanEventHandler() + return c, nil }