From d96298461feb40f5e5ae463895b545c9f9c8ee71 Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Wed, 19 Jan 2022 10:51:40 -0500 Subject: [PATCH] Don't say we've shut down cluster listener before having done so (#13679) --- changelog/13679.txt | 3 +++ vault/cluster/cluster.go | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/13679.txt diff --git a/changelog/13679.txt b/changelog/13679.txt new file mode 100644 index 000000000..c907ee742 --- /dev/null +++ b/changelog/13679.txt @@ -0,0 +1,3 @@ +```release-note:bug +core: Fix how we report the cluster listener is done, prevents `bind: address already in use` errors. +``` \ No newline at end of file diff --git a/vault/cluster/cluster.go b/vault/cluster/cluster.go index f5d25d73b..b818a7ac2 100644 --- a/vault/cluster/cluster.go +++ b/vault/cluster/cluster.go @@ -6,8 +6,6 @@ import ( "crypto/x509" "errors" "fmt" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/hashicorp/vault/sdk/helper/tlsutil" "net" "net/url" "os" @@ -16,7 +14,9 @@ import ( "time" log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/consts" + "github.com/hashicorp/vault/sdk/helper/tlsutil" "golang.org/x/net/http2" ) @@ -279,9 +279,9 @@ func (cl *Listener) Run(ctx context.Context) error { // Start our listening loop go func(closeCh chan struct{}, tlsLn net.Listener) { defer func() { - cl.shutdownWg.Done() tlsLn.Close() close(closeCh) + cl.shutdownWg.Done() }() // baseDelay is the initial delay after an Accept() error before attempting again