[
https://issues.apache.org/jira/browse/CAMEL-23282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070854#comment-18070854
]
Jayaharish M R commented on CAMEL-23282:
----------------------------------------
Hi [~fmariani] ,
Thanks for the quick turnaround on this.
I’ll validate the reproducer and share feedback shortly. From our side, the
behavior aligns with what we observed in our pipelines, so this looks
consistent with the issue we reported.
Appreciate you picking this up and working on the fix — please let me know if
you need any additional inputs from our side.
> 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
> Fix For: 4.14.6, 4.18.2, 4.19.0
>
> Attachments: camel-23282-reproducer.zip
>
>
> *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)