Spring proxy cache causes PermGen OOME across redeployments

Solution Unverified - Updated -

Issue

  • JBoss hits a PermGen OOME after redeploying our spring app many times. It looks like the app classloaders are leaked on redeploy and persisted by a WeakHashMap in org.springframework.cglib.core.AbstractClassGenerator$Source:
org.jboss.modules.ModuleClassLoader @ 0xf3ac5348                                                                      |
'- <classloader> class com.my.custom.Class @ 0xf3ac3808                  |
   '- targetClass org.springframework.aop.target.EmptyTargetSource @ 0xf3db3388                                       |
      '- targetSource org.springframework.aop.framework.AdvisedSupport @ 0xf3db3358                                   |
         '- advised org.springframework.aop.framework.CglibAopProxy$ProxyCallbackFilter @ 0xf3db3340                  |
            '- FIELD_2 org.springframework.cglib.proxy.Enhancer$EnhancerKey$$KeyFactoryByCGLIB$$4ce19e8f @ 0xf3db32f0 |
               '- key java.util.HashMap$Entry @ 0xf3db32d0                                                            |
                  '- [12] java.util.HashMap$Entry[16] @ 0xf3db3280                                                    |
                     '- table java.util.HashMap @ 0xf3db3250                                                          |
                        '- value java.util.WeakHashMap$Entry @ 0xf3db3228                                             |
                           '- next java.util.WeakHashMap$Entry @ 0xf8969c48                                           |
                              '- [54] java.util.WeakHashMap$Entry[64] @ 0xf79780f0                                    |
                                 '- table java.util.WeakHashMap @ 0xf15ae600                                          |
                                    '- cache org.springframework.cglib.core.AbstractClassGenerator$Source @ 0xf15ae570|
                                       '- SOURCE class org.springframework.cglib.proxy.Enhancer @ 0xf15ad538 

Environment

  • JBoss Enterprise Application Platform (EAP) 6.x
  • Spring

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.