From 96507ad1a505238fce1352c3955158f264bd4a61 Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky <2685025+getvictor@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:14:31 +0200 Subject: [PATCH] Fixed potential panic in error handler when Redis is down. (#31643) --- changes/30455-errorstore-panic | 1 + server/errorstore/errors.go | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 changes/30455-errorstore-panic diff --git a/changes/30455-errorstore-panic b/changes/30455-errorstore-panic new file mode 100644 index 0000000000..1b2266f512 --- /dev/null +++ b/changes/30455-errorstore-panic @@ -0,0 +1 @@ +Fixed potential panic in error handler when Redis is down. diff --git a/server/errorstore/errors.go b/server/errorstore/errors.go index 08bbb8c725..0a0b484700 100644 --- a/server/errorstore/errors.go +++ b/server/errorstore/errors.go @@ -12,6 +12,7 @@ import ( "crypto/sha256" "encoding/base64" "encoding/json" + "errors" "fmt" "net/http" "strconv" @@ -208,6 +209,14 @@ func (h *Handler) storeError(ctx context.Context, err error) { return } + // Check if pool is nil to prevent panic + if h.pool == nil { + if h.testOnStore != nil { + h.testOnStore(errors.New("redis pool is nil")) + } + return + } + // not using a connection that follows redirections here // in order to do pipeline commands conn := h.pool.Get()