From 7b739ae537b5058d9f93c8eefcb4e17b9160b9f0 Mon Sep 17 00:00:00 2001 From: hc-github-team-nomad-core <82989552+hc-github-team-nomad-core@users.noreply.github.com> Date: Fri, 2 Sep 2022 15:22:03 -0400 Subject: [PATCH] Backport of Fix error handling in Client consulDiscoveryImpl into release/1.2.x (#14454) This pull request was automerged via backport-assistant --- .changelog/14431.txt | 3 +++ client/client.go | 1 + 2 files changed, 4 insertions(+) create mode 100644 .changelog/14431.txt diff --git a/.changelog/14431.txt b/.changelog/14431.txt new file mode 100644 index 00000000000..f6a1a7a5065 --- /dev/null +++ b/.changelog/14431.txt @@ -0,0 +1,3 @@ +```release-note:bug +client: Fixed bug where clients could attempt to connect to servers with invalid addresses retrieved from Consul. +``` diff --git a/client/client.go b/client/client.go index 4bca317a566..8383bcdcd1d 100644 --- a/client/client.go +++ b/client/client.go @@ -2793,6 +2793,7 @@ DISCOLOOP: addr, err := net.ResolveTCPAddr("tcp", p) if err != nil { mErr.Errors = append(mErr.Errors, err) + continue } srv := &servers.Server{Addr: addr} nomadServers = append(nomadServers, srv)