Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-969

Incorrect closing of ClientResources

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.14 (Kay SR14)
    • Fix Version/s: None
    • Component/s: Lettuce Driver
    • Labels:
      None
    • Environment:
      Windows 10

      Description

      LettuceConnectionFactory#afterPropertiesSet method if the called twice, there is the risk of memory leaks.

       

      LettuceConnectionFactory#createClient method  code snippet:

      RedisURI uri = createRedisURIAndApplySettings(getHostName(), getPort());
      RedisClient redisClient = clientConfiguration.getClientResources() // .map(clientResources -> RedisClient.create(clientResources, uri)) // .orElseGet(() -> RedisClient.create(uri));//   is here
      clientConfiguration.getClientOptions().ifPresent(redisClient::setOptions);
      

      The second time you create clientResources, you do not release the previous clientResources.Memory leaks are reported when garbage collection occurs.

      solution: When you create a new clientResources, you need to call clientResources' shutdown method manually, guaranteeing shutdown before garbage collection

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            jkaka jkaka
            Last updater:
            jkaka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: