You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christopher Hammack <ch...@fadedsky.com> on 2009/02/06 21:09:11 UTC
Classloading leak in camel-jaxb component
We recently discovered an issue in the camel-jaxb component which has caused
a serious issue in our environment: after several days of uptime, we have
millions of classes loaded in the permgen space. We were passing around an
object between bean components which was annotated with @XmlRootElement, and
even though the types matched between the output of one bean component and
the input of the next bean component, the object was being transformed using
jaxb (possibly a bug there as well).
Anyhow, each time this happens, this piece of code from JaxbConverter
executes:
protected static JAXBContext createJaxbContext(Object value) throws
JAXBException {
if (value == null) {
throw new IllegalArgumentException("Cannot convert from null
value to JAXBSource");
}
JAXBContext context = JAXBContext.newInstance(value.getClass());
return context;
}
However, each time when a JAXBContext is created, the JAXB package generates
several on the fly classes which are not reused between JAXBContexts. This
is documented here: https://jaxb.dev.java.net/issues/show_bug.cgi?id=581
This results, in our case, in millions of classes named
XXX_JaxbXducedAccessor_avail and XXX$JaxbAccessorF_YYY being loaded into
permgen and never collected. After some period of time, permgen space will
fill and the jvm will crash.
Creating a JAXBContext in this way is not safe. Also, it's not clear why
passing an object between two bean components would invoke a JAXB
serialization in the first place.
Thanks.
--
View this message in context: http://www.nabble.com/Classloading-leak-in-camel-jaxb-component-tp21879801s22882p21879801.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Classloading leak in camel-jaxb component
Posted by Claus Ibsen <cl...@gmail.com>.
Hi Chris
I have commtied a quick fix for the is in 1.x. Do you mind trying out
by checking out the source and build a camel-jaxb component?
Hadrian is working in on closing on a 1.6.0 release and would be great
to have this tested in your environment before we cut the 1.6.0
release.
On Sat, Feb 7, 2009 at 2:06 AM, Hadrian Zbarcea <hz...@gmail.com> wrote:
> Christopher,
>
> Thanks for catching this and pointing it out. We'll be looking into it and
> hopefully it will make the upcoming 1.6 release. I assume you are using
> camel-1.5. Would it be possible to attach a quick test and save us a bit of
> time?
>
> Hadrian
>
>
>
> On Feb 6, 2009, at 3:09 PM, Christopher Hammack wrote:
>
>>
>> We recently discovered an issue in the camel-jaxb component which has
>> caused
>> a serious issue in our environment: after several days of uptime, we have
>> millions of classes loaded in the permgen space. We were passing around
>> an
>> object between bean components which was annotated with @XmlRootElement,
>> and
>> even though the types matched between the output of one bean component and
>> the input of the next bean component, the object was being transformed
>> using
>> jaxb (possibly a bug there as well).
>>
>> Anyhow, each time this happens, this piece of code from JaxbConverter
>> executes:
>> protected static JAXBContext createJaxbContext(Object value) throws
>> JAXBException {
>>
>> if (value == null) {
>>
>> throw new IllegalArgumentException("Cannot convert from null
>> value to JAXBSource");
>>
>> }
>>
>> JAXBContext context = JAXBContext.newInstance(value.getClass());
>>
>> return context;
>>
>> }
>>
>> However, each time when a JAXBContext is created, the JAXB package
>> generates
>> several on the fly classes which are not reused between JAXBContexts.
>> This
>> is documented here: https://jaxb.dev.java.net/issues/show_bug.cgi?id=581
>>
>> This results, in our case, in millions of classes named
>> XXX_JaxbXducedAccessor_avail and XXX$JaxbAccessorF_YYY being loaded into
>> permgen and never collected. After some period of time, permgen space
>> will
>> fill and the jvm will crash.
>>
>> Creating a JAXBContext in this way is not safe. Also, it's not clear why
>> passing an object between two bean components would invoke a JAXB
>> serialization in the first place.
>>
>> Thanks.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Classloading-leak-in-camel-jaxb-component-tp21879801s22882p21879801.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Re: Classloading leak in camel-jaxb component
Posted by Hadrian Zbarcea <hz...@gmail.com>.
Christopher,
Thanks for catching this and pointing it out. We'll be looking into
it and hopefully it will make the upcoming 1.6 release. I assume you
are using camel-1.5. Would it be possible to attach a quick test and
save us a bit of time?
Hadrian
On Feb 6, 2009, at 3:09 PM, Christopher Hammack wrote:
>
> We recently discovered an issue in the camel-jaxb component which
> has caused
> a serious issue in our environment: after several days of uptime, we
> have
> millions of classes loaded in the permgen space. We were passing
> around an
> object between bean components which was annotated with
> @XmlRootElement, and
> even though the types matched between the output of one bean
> component and
> the input of the next bean component, the object was being
> transformed using
> jaxb (possibly a bug there as well).
>
> Anyhow, each time this happens, this piece of code from JaxbConverter
> executes:
> protected static JAXBContext createJaxbContext(Object value) throws
> JAXBException {
>
> if (value == null) {
>
> throw new IllegalArgumentException("Cannot convert from
> null
> value to JAXBSource");
>
> }
>
> JAXBContext context =
> JAXBContext.newInstance(value.getClass());
>
> return context;
>
> }
>
> However, each time when a JAXBContext is created, the JAXB package
> generates
> several on the fly classes which are not reused between
> JAXBContexts. This
> is documented here: https://jaxb.dev.java.net/issues/show_bug.cgi?id=581
>
> This results, in our case, in millions of classes named
> XXX_JaxbXducedAccessor_avail and XXX$JaxbAccessorF_YYY being loaded
> into
> permgen and never collected. After some period of time, permgen
> space will
> fill and the jvm will crash.
>
> Creating a JAXBContext in this way is not safe. Also, it's not
> clear why
> passing an object between two bean components would invoke a JAXB
> serialization in the first place.
>
> Thanks.
>
> --
> View this message in context: http://www.nabble.com/Classloading-leak-in-camel-jaxb-component-tp21879801s22882p21879801.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>