Benoit AVERTY created CAMEL-16104:
-------------------------------------
Summary: ProducerCache does not close producers when cacheSize is
1 (potential memory leak)
Key: CAMEL-16104
URL: https://issues.apache.org/jira/browse/CAMEL-16104
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 3.3.0
Reporter: Benoit AVERTY
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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)