[ 
https://issues.apache.org/jira/browse/CAMEL-23282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070842#comment-18070842
 ] 

Federico Mariani commented on CAMEL-23282:
------------------------------------------

Hi [~jayaharishmr] thanks for reporting this issue.

I confirm that this is a bug. Attached you can find a reproducer, if you can 
provide a feedback on the reproducer would be nice.

I am going to open the PRs with the fix

> Simple OGNL ${body.xxx} causes unbounded BeanInfo cache growth for ephemeral 
> message bodies
> -------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-23282
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23282
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 4.13.0, 4.18.1
>            Reporter: Jayaharish M R
>            Assignee: Federico Mariani
>            Priority: Critical
>
> *Problem:* {{${body.xxx}}} Simple expressions route through {{BeanLanguage}} 
> → {{ConstantBeanHolder}} → {{{}BeanInfo{}}}, which caches the message body 
> instance in {{{}BeanInfoCacheKey{}}}. For non-singleton bodies (new object 
> per message), this creates a new cache entry per message because 
> {{BeanInfoCacheKey.equals()}} falls through to {{Object.equals()}} (identity 
> comparison). The {{SimpleSoftCache}} accumulates these indefinitely.
> *Impact:* OOM crash every 4-5 days in production. Each cached instance 
> retains the full data payload (~120 MB in our case).
> *Reproduction steps:* Any route using {{${body.xxx}}} on a body type that 
> doesn't override {{equals()}} and is recreated per message.
> *Root cause:* The {{instanceBased}} flag in {{BeanInfo}} constructor forces 
> caching with the instance reference. The cache was designed for singleton 
> Spring beans, not ephemeral exchange bodies.
> *Suggested fix:* When {{{}BeanLanguage{}}}/{{{}bodyOgnlExpression{}}} 
> resolves OGNL on a message body, either skip the bean info cache entirely, or 
> always use {{key2}} (class-only, no instance) for body OGNL since the 
> introspection result depends only on the class, not the instance.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to