diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4b94363..9fbd1acf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ BUG FIXES: * agent: Added new form of `consul.http.*` metrics that were accidentally left out of Consul 1.0. [[GH-3654](https://github.com/hashicorp/consul/issues/3654)] * agent: Fixed an issue with the server manager where periodic server client connection rebalancing could select a failed server. This affects agents in client mode, as well as servers talking to other servers, including over the WAN. [[GH-3463](https://github.com/hashicorp/consul/issues/3463)] * agent: IPv6 addresses without port numbers and without surrounding brackets are now properly handled for joins. This affects all join types, but in particular this was discovered with AWS joins where the APIs return addresses formatted this way. [[GH-3671](https://github.com/hashicorp/consul/issues/3671)] +* agent: Fixed a rare startup panic of the Consul agent related to the LAN Serf instance ordering with the router manager. [[GH-3680](https://github.com/hashicorp/consul/issues/3680)] * dns: Fixed an issue were components of a host name near the datacenter could be quietly ignored (eg. `foo.service.dc1.extra.consul` would silently ignore `.extra`); now an `NXDOMAIN` error will be returned. [[GH-3200](https://github.com/hashicorp/consul/issues/3200)] * server: Fixed an issue where performing rolling updates of Consul servers could result in an outage from old servers remaining in the cluster. Consul's Autopilot would normally remove old servers when new ones come online, but it was also waiting to promote servers to voters in pairs to maintain an odd quorum size. The pairwise promotion feature was removed so that servers become voters as soon as they are stable, allowing Autopilot to remove old servers in a safer way. When upgrading from Consul 1.0, you may need to manually force-leave old servers as part of a rolling update to Consul 1.0.1. [[GH-3611](https://github.com/hashicorp/consul/issues/3611)] diff --git a/agent/consul/client.go b/agent/consul/client.go index 466780727..96baeb174 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 }