[
https://issues.apache.org/jira/browse/CAMEL-23282?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Federico Mariani reassigned CAMEL-23282:
----------------------------------------
Assignee: Federico Mariani
> 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)