[jboss-user] [Performance Tuning] - Memory leak on org.jboss.classloader.spi.base.BaseClassLoader

Ryan Hochstetler do-not-reply at jboss.com
Mon Aug 2 16:58:14 EDT 2010

Ryan Hochstetler [http://community.jboss.org/people/ryanhos] replied to the discussion

"Memory leak on org.jboss.classloader.spi.base.BaseClassLoader"

To view the discussion, visit: http://community.jboss.org/message/555500#555500

This is the class blacklist.  I researched this back when we were on JBoss 4.2.3 and now I'm revisiting it for JBoss 5.1.0, since things seem to have changed.

Hibernate calls class.forName() on every token in each unique query.  This is one of many reasons why it's crucially important to use bind parameters in your queries.  If you are using bind params, your query is parsed by Hibernate once, then placed in some parsed query cache.  This parsing is what calls Class.forName() on each token in the query.  If you're not using bind params, each query looks unique, and it gets reparsed each time the aruments in the WHERE clause change.  The endless stream of unique arguments in the where clause (from your 100k SOAP requests) end up as parameters to Class.forName().  JBoss's classloader caches failed class lookups, as a performance enhancement.  In JBoss 4.2.3, this was done in RepositoryClassLoader.  It was possible to set two properties which would not stop the accumulation in the class blacklist, but would stop the OutOfMemoryErrors from occurring by allowing the JVM to cull the blacklist when memory gets tight.


However, in JBoss 5.1.0, (probably 5.x on), RepositoryClassLoader appears to be unused (zero instances in my heap dump today).  The class blacklist is now contained in BaseClassLoader, which does not have the same runaway allocation guard, as far as I can tell.

You might try filing a JIRA since this seems like a regression, but Adrian Brock has already weighed-in on the topic once before, and he's of the opinion that it's the framework's problem, not JBoss'.  "There are many "stupid" webapp frameworks (and other code) around that try to continually load non-existant classes."   https://jira.jboss.org/browse/JBAS-3041 https://jira.jboss.org/browse/JBAS-3041

In short, make sure that each and every one of your queries uses bind params, for this reason and numerous others all related to increased performance and security.


Reply to this message by going to Community

Start a new discussion in Performance Tuning at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100802/ad76139f/attachment.html 

More information about the jboss-user mailing list