camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Hammack <chamm...@fadedsky.com>
Subject Classloading leak in camel-jaxb component
Date Fri, 06 Feb 2009 20:09:11 GMT

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.


Mime
View raw message