From c65b7b6531d34cfb85bdbfb5742eda39a4aa6fc6 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Wed, 23 Sep 2026 16:46:58 +0200 Subject: [PATCH] jetty: drop per-client and global rate limiter Motivation: as the behaviour of the rate limiter doesn't match admins expectations and introduces lot of complains, let disable per-client and global rate limiter. Modification: comment out per-client and global rate limiter. Result: enforce rate limitesr only for authentication errors. Fixes: #8102 Acked-by: Anastasiia Chub Target: master, 12.0, 11.2 Require-book: no Require-notes: yes (cherry picked from commit d7646623a752ac11edf8410c7e6a91b87a90d838) Signed-off-by: Tigran Mkrtchyan --- .../java/org/dcache/util/jetty/RateLimitedHandlerList.java | 6 +++++- .../org/dcache/util/jetty/RateLimitedHandlerListTest.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/dcache/src/main/java/org/dcache/util/jetty/RateLimitedHandlerList.java b/modules/dcache/src/main/java/org/dcache/util/jetty/RateLimitedHandlerList.java index ea8801e2f97..a97f6eb54d8 100644 --- a/modules/dcache/src/main/java/org/dcache/util/jetty/RateLimitedHandlerList.java +++ b/modules/dcache/src/main/java/org/dcache/util/jetty/RateLimitedHandlerList.java @@ -240,6 +240,10 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques return; } + + + // REVISIT: do we want to keep per-client rate limiter or only for authentication errors? + /* if (!getClientRateLimiter(client).tryAcquire()) { LOGGER.debug("Blocking client with too many requests {}", client); response.setStatus(HttpStatus.TOO_MANY_REQUESTS_429); @@ -257,7 +261,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques baseRequest.setHandled(true); return; } - + */ Handler[] handlers = this.getHandlers(); if (handlers != null && this.isStarted()) { for (Handler handler : handlers) { diff --git a/modules/dcache/src/test/java/org/dcache/util/jetty/RateLimitedHandlerListTest.java b/modules/dcache/src/test/java/org/dcache/util/jetty/RateLimitedHandlerListTest.java index 1976743f892..f2882d60d68 100644 --- a/modules/dcache/src/test/java/org/dcache/util/jetty/RateLimitedHandlerListTest.java +++ b/modules/dcache/src/test/java/org/dcache/util/jetty/RateLimitedHandlerListTest.java @@ -5,6 +5,7 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; @@ -82,6 +83,7 @@ public void testGlobalRateOk() throws ServletException, IOException, Interrupted @Test + @Ignore public void testGlobalRateExceeded() throws ServletException, IOException, InterruptedException { handlerList.setMaxGlobalRequestsPerSecond(10);