From ee7beca61f6d46210158565a7281ac29819994c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Mon, 9 Dec 2024 10:20:21 +0200 Subject: [PATCH] fix(cache): ignore NOSCRIPT errors in redis circuit breaker (#9022) # Which Problems Are Solved When Zitadel starts the first time with a configured Redis cache, the circuit break would open on the first requests, with no explanatory error and only log-lines explaining the state of the Circuit breaker. Using a debugger, `NOSCRIPT No matching script. Please use EVAL.` was found the be passed to `Limiter.ReportResult`. This error is actually retried by go-redis after a [`Script.Run`](https://pkg.go.dev/github.com/redis/go-redis/v9@v9.7.0#Script.Run): > Run optimistically uses EVALSHA to run the script. If script does not exist it is retried using EVAL. # How the Problems Are Solved Add the `NOSCRIPT` error prefix to the whitelist. # Additional Changes - none # Additional Context - Introduced in: https://github.com/zitadel/zitadel/pull/8890 - Workaround for: https://github.com/redis/go-redis/issues/3203 --- internal/cache/connector/redis/circuit_breaker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/cache/connector/redis/circuit_breaker.go b/internal/cache/connector/redis/circuit_breaker.go index 1e06b7387..fd556b52b 100644 --- a/internal/cache/connector/redis/circuit_breaker.go +++ b/internal/cache/connector/redis/circuit_breaker.go @@ -86,5 +86,6 @@ func (l *limiter) ReportResult(err error) { done := <-l.inflight done(err == nil || errors.Is(err, redis.Nil) || - errors.Is(err, context.Canceled)) + errors.Is(err, context.Canceled) || + redis.HasErrorPrefix(err, "NOSCRIPT")) }