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

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



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.0, 3.7.1
    • Fix Version/s: 3.7.2, 3.8.0
    • Component/s: camel-core
    • Labels:
    • Estimated Complexity:


      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.




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


              • Created: