You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: recordTokensUsage does opsForValue().increment(cacheKey, tokens).flatMap(currentValue -> reactiveRedisTemplate.expire(cacheKey, Duration.ofSeconds(windowSeconds))).subscribe(). Because expire is re-issued after every increment, as long as requests keep arriving within windowSeconds the key never expires and the counter is never reset. The intended "token budget N per window" becomes a monotonic lifetime cap.
impact: Time-window token quotas do not reset on schedule; sustained traffic gets permanently throttled until a quiet period.
suggested_fix: Set the TTL only on key creation (e.g. INCR then EXPIRE NX, or a small lua that sets expiry only when EXISTS is false).
shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-token-limiter/src/main/java/org/apache/shenyu/plugin/ai/token/limiter/AiTokenLimiterPlugin.java:177-183recordTokensUsagedoesopsForValue().increment(cacheKey, tokens).flatMap(currentValue -> reactiveRedisTemplate.expire(cacheKey, Duration.ofSeconds(windowSeconds))).subscribe(). Becauseexpireis re-issued after every increment, as long as requests keep arriving withinwindowSecondsthe key never expires and the counter is never reset. The intended "token budget N per window" becomes a monotonic lifetime cap.INCRthenEXPIRE NX, or a small lua that sets expiry only whenEXISTSis false).Identified during the 2026-08-02 deep re-scan; full list in
docs/scan2-2026-08-02/00-consolidated-critical-high.md.