Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3736

javax.el.BeanELResolver.properties keeps references to undeployed classes (Class Loader leak)

    XMLWordPrintable

Details

    Description

      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

      private static final ConcurrentHashMap<Class, BeanProperties> properties =
               new ConcurrentHashMap<Class, BeanProperties>(CACHE_SIZE);
      

      to

      private static final Map<Class<?>, SoftReference<BeanProperties>> properties =
               Collections.synchronizedMap(new WeakHashMap<Class<?>, SoftReference<BeanProperties>>(CACHE_SIZE));
      

      But I'm not really sure if that's a good idea to replace the ConcurrentHashMap with a SynchronizedMap and I had to change

      properties.putIfAbsent(baseClass, bps);

      By

      synchronized(properties) {
          if (!properties.containsKey(baseClass))
              properties.put(baseClass, new SoftReference<BeanProperties>(bps));
      }
      

      Attachments

        Issue Links

          Activity

            People

              sdouglas1@redhat.com Stuart Douglas
              guinotphil Philippe Guinot (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: