[jboss-jira] [JBoss JIRA] (AS7-3736) javax.el.BeanELResolver.properties keeps references to undeployed classes (Class Loader leak)

Philippe Guinot (JIRA) jira-events at lists.jboss.org
Mon Feb 13 08:50:01 EST 2012


Philippe Guinot created AS7-3736:
------------------------------------

             Summary: javax.el.BeanELResolver.properties keeps references to undeployed classes (Class Loader leak)
                 Key: AS7-3736
                 URL: https://issues.jboss.org/browse/AS7-3736
             Project: Application Server 7
          Issue Type: Bug
          Components: EE
    Affects Versions: 7.1.0.CR1b
         Environment: Seam 2.2.2 application
            Reporter: Philippe Guinot
            Assignee: David Lloyd


This is another Class Loader leak memory issue. When class are loaded into the properties map, they don't get unloaded at undeploy. This cause the whole application's class loader not being garbage collected and so will result in OutOfMemoryError: PermGen space after a few deployments.

The solution would be to call the purgeBeanClasses method at undeploy with each of the class loader of all sub-modules of the application.


For the moment, the work around I've done was to change
{code}private static final ConcurrentHashMap<Class, BeanProperties> properties =
         new ConcurrentHashMap<Class, BeanProperties>(CACHE_SIZE);
{code}to{code}
private static final Map<Class<?>, SoftReference<BeanProperties>> properties =
         Collections.synchronizedMap(new WeakHashMap<Class<?>, SoftReference<BeanProperties>>(CACHE_SIZE));
{code}
But I'm not really sure if that's a good idea to replace the ConcurrentHashMap with a SynchronizedMap and I had to change
{code}properties.putIfAbsent(baseClass, bps);{code}
By{code}
synchronized(properties) {
    if (!properties.containsKey(baseClass))
        properties.put(baseClass, new SoftReference<BeanProperties>(bps));
}
{code}


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

        


More information about the jboss-jira mailing list