Skip to content

[BUG] Hystrix / Resilience4J / Sentinel / RateLimiter plugins NPE when a matched rule has no cached handle #6877

Closed

Description

@Aias00

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.

Activity

  1. github-actions commented on Aug 4, 2026

    @github-actions
    Contributor

    👋 Hello @yuluo-yx

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

  2. zhang-arvin commented on Aug 30, 2026

    @zhang-arvin
    Contributor

    I will work on this.

  3. added a commit that references this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions