Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16104

ProducerCache does not close producers when cacheSize is 1 (potential memory leak)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0, 3.7.1
    • 3.7.2, 3.8.0
    • camel-core
    • None
    • Unknown

    Description

      I'm using a route with a dynamic endpoint using toD and a cache size of 1.

      In my case, the dynamic URI changes once a day. When the day changes, I want a new producer to be created and the old one closed.

      However, the new producer is correctly created but the old one is not closed.

      When I use a cache size of 2, then when the day ends two new producers are created and the two old ones are closed correctly.

      I've tracked down the problem to the last line of the ServicePool constructor, where a LRU cache is created only if the cache size is greater than one. This LRU cache is the one calling the evict method, so when there is no cache there is no eviction on the ServicePool used by the ProducerCache.

      Using the debugger, i confirmed that the service pool contains two producers even though its capacity is 1. I'm afraid this could be a memory leak.

      I'm not sure of the best way to resolve this, but it's a problem for me because if the producer is not closed, then an operation I need is note performed (I'm using the HDFS component, and it needs to rename a file when the producer is closed. Currently, the file is not renamed and I'm afraid some data is not flushed to the server)

      I hope I was clear, please do ask if there is something unclear in my description of the problem.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            BenoitAverty Benoit AVERTY
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: