camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piotr Bzdyl (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-3813) XPathBuilder doesn't clear ThreadLocal with exchange after evaluation
Date Mon, 30 Jul 2012 14:19:35 GMT

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

Piotr Bzdyl commented on CAMEL-3813:
------------------------------------

In my case the problem was with using @XPath annotation on the bean method argument. When
such annotation is used, BeanProcessor uses a copy of the original exchange and that copy
is provided to the XPathBuilder instance implementing @XPath annotated argument extraction.
For that exchange copy its XPathBuilderCompletion is not executed so the solution provided
in this issue doesn't fix this.

What's worse, BeanExpression.evaluate(Exchange exchange) creates a holder instance for each
invocation and a new XPathBuilder instance is created (through new ConstantHolder -> new
BeanInfo -> ... -> BeanInfo.createParameterUnmarshalExpressionForAnnotation -> XPathAnnotationExpressionFactory.createExpression)
so for each such evaluate calls two XPathBuilder's thread locals are leaking.

[CAMEL-5392] optimizes BeanExpression.evaluate by caching the holder instance and thus prevents
the leakage. However, the thread locals are not eligible for GC until another exchange processing
in the same thread overrides them with new values as the completion is not being called on
the exchange copy. As a result those thread locals objects might be retained much longer than
the exchange life.
                
> XPathBuilder doesn't clear ThreadLocal with exchange after evaluation
> ---------------------------------------------------------------------
>
>                 Key: CAMEL-3813
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3813
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.7.0
>            Reporter: Marcin Kolda
>            Assignee: Claus Ibsen
>            Priority: Minor
>              Labels: xpath
>             Fix For: 2.8.0
>
>         Attachments: bug_reproduction.patch
>
>
> XPathBuilder doesn't clear ThreadLocal with exchange (and variableResolver) after evaluation.
In such case reference to current exchange (and body, headers, properties, etc.) remains in
Thread until current thread dies or evaluates new exchange with the same XPathBuilder instance.
> The result of this is that each thread can contain references to multiple exchanges (up
to the number of xpaths in camel context), that can't be collected by GC.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message