Description
handlerPlugin checks if the new RedisConfigProperties differs from the cached singleton. If it differs, it constructs a new RedisConnectionFactory (which opens Lettuce connection pools via afterPropertiesSet()), stores the new ReactiveRedisTemplate and RedisConfigProperties into Singleton.INST, but never calls destroy() on the OLD LettuceConnectionFactory. The old factory's connection pool (sockets, NIO event loops, threads) is orphaned. Trigger: any admin update that changes the redis URL, password, database, or pool settings.
Location
shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java:50-65
shenyu-infra/shenyu-infra-redis/src/main/java/org/apache/shenyu/infra/redis/RedisConnectionFactory.java:43-48
Impact
Each redis config change permanently leaks a Lettuce connection pool. Repeated config updates accumulate leaked connections, eventually exhausting file descriptors / sockets and degrading gateway stability.
Suggested fix
Before installing the new factory, retrieve the old ReactiveRedisTemplate from Singleton.INST, extract its LettuceConnectionFactory (or track the old RedisConnectionFactory), and call destroy() on it before Singleton.INST.single(...).
Related existing
None — distinct from #6645 (RedisRateLimiter fail-open) because this is a resource-leak in the data handler's config-update path, not the rate-limiting execution path.
Description
handlerPluginchecks if the newRedisConfigPropertiesdiffers from the cached singleton. If it differs, it constructs a newRedisConnectionFactory(which opens Lettuce connection pools viaafterPropertiesSet()), stores the newReactiveRedisTemplateandRedisConfigPropertiesintoSingleton.INST, but never callsdestroy()on the OLDLettuceConnectionFactory. The old factory's connection pool (sockets, NIO event loops, threads) is orphaned. Trigger: any admin update that changes the redis URL, password, database, or pool settings.Location
shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java:50-65shenyu-infra/shenyu-infra-redis/src/main/java/org/apache/shenyu/infra/redis/RedisConnectionFactory.java:43-48Impact
Each redis config change permanently leaks a Lettuce connection pool. Repeated config updates accumulate leaked connections, eventually exhausting file descriptors / sockets and degrading gateway stability.
Suggested fix
Before installing the new factory, retrieve the old
ReactiveRedisTemplatefromSingleton.INST, extract itsLettuceConnectionFactory(or track the oldRedisConnectionFactory), and calldestroy()on it beforeSingleton.INST.single(...).Related existing
None — distinct from #6645 (
RedisRateLimiterfail-open) because this is a resource-leak in the data handler's config-update path, not the rate-limiting execution path.