From f91fcdbe4bb84d38422a7807d2e683e60de44aa8 Mon Sep 17 00:00:00 2001 From: Gunjan Jaswal Date: Tue, 30 Jun 2026 11:32:08 +0530 Subject: [PATCH] Fix connection throttle cleanup wiping the whole tracker The stale-entry cleanup compared a stored timestamp directly against the throttle duration (`time > connectionThrottle`). A real epoch timestamp is always far greater than the configured duration (default 4000ms), so the predicate matched every entry and cleared the entire throttleTracker every ~200 connections. Between cleanups a client could reconnect around the cycle and dodge the per-IP throttle. Compare elapsed time instead (`currentTime - time > connectionThrottle`), matching the check used a few lines above where the same `currentTime` is already computed. Fixes #13984. --- .../server/network/ServerHandshakePacketListenerImpl.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch index 3dc489fc8f03..bbee1ac5588e 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java.patch @@ -66,7 +66,7 @@ + ServerHandshakePacketListenerImpl.throttleCounter = 0; + + // Cleanup stale entries -+ ServerHandshakePacketListenerImpl.throttleTracker.values().removeIf(time -> time > connectionThrottle); ++ ServerHandshakePacketListenerImpl.throttleTracker.values().removeIf(time -> currentTime - time > connectionThrottle); + } + } + }