Java config FactoryBean proxy causes class loader leak [SPR-9274] #13912
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Harald Wellmann opened SPR-9274 and commented
Redeploying my web application in Tomcat a couple of times in a row, I had a PermGen space OutOfMemoryError. A heap dump revealed the cause to be a net.sf.cglib.proxy.Callback stored in thread-local memory, so that the associated class loader could not get garbage collected.
The callback holds a reference to ConfigurationClassEnhancer.GetObjectMethodInterceptor, which brought me closer to the root cause of the problem.
After changing my Spring Configuration from
to
I can redeploy my application without memory leaks.
I suspect the problem would disappear if ConfigurationClassEnhancer.enhanceFactoryBean() called Enhancer.registerStaticCallbacks() instead of Enhancer.registerCallbacks() (see #10601).
Affects: 3.1 GA, 3.2.8
Issue Links:
@Bean
methods behave like prototypes in a Spring DM environmentBackported to: 3.2.9
5 votes, 5 watchers
The text was updated successfully, but these errors were encountered: