Details
-
Bug
-
Resolution: Done
-
Critical
-
fuse-7.3, fuse-7.4-GA, fuse-6.x-GA
-
None
Description
Even when explicitly setting the camelcontext cache size limit, dynamic processors are able to add objects without any limit. If a custom endpoint is created, this can also easily violate the configured limit. Even if the route containing the dynamic endpoint is stopped, the cache size does not shrink as a result.
Camelcontext cache should be kept as private and access (for dynamic endpoints / processors or any custom component) should be only via methods that ensure size limit is not exceeded in order to prevent dynamic or other custom or new endpoint typed from violating this size constraint."
For example; a CamelContext is using shared Producer service pool ( a 2 dimensional cache using a Concurrent Map and BlockedQueue structure). The core of this pool is a ConcurrentMap - which does not have a size restriction nor any size check implemented by DefaultServicePool. The items in this pool are BlockedQueue types having a size limit. But the ConcurrentMap does not.
As per the design any Endpoint (egs: DynamicEndpoint ) can use this shared pool across the context and keep adding to it. This design creates a memory leak. There is no way to restrict this cache size.
As an illustration - when trying to wire the LRUCache into the producer service pool within CamelContext using the setProducerServicePool method within the CamelContextStarted event - or even at runtime - it made no difference to the caching. The toD component keeps on adding to the original concurrrent map (which is the default value in the class) instead of the LRUCache that was set. Having enabled access to the cache/object pointer directly to the endpoints created an uncontrolled cache/pointer leak issue. To work around this I had to wire the LRUCache at the event CamelContextStarting event.
Would it be possible to Replace the default ConcurrentMap with a size restricted cache? Otherwise, this issues seems like it will inevitably cause downtime production issues.
Attachments
Issue Links
- relates to
-
ENTESB-11307 toD endpoints exceeds the CamelMaximumEndpointCacheSize limit for CAMELCONTEXT
- Closed