• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • ehcache-core
  • lorban
  • Reporter: naggy
  • March 23, 2012
  • 0
  • Watchers: 2
  • July 27, 2012
  • April 16, 2012



I possibly ran into a memory leak issue that appears when xa_strict mode is used.

Tested configurations: a.) standalone: Grails 2.0.1 (which uses Hibernate 3.6.7) with JOTM b.) Grails 2.0.1 app inside Glassfish 3.1.2 (no clustering)

hibernate.cache.use_second_level_cache = true hibernate.cache.use_query_cache = true hibernate.cache.region.factory_class = ‘net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory’

Symptoms: heap usage increases slowly when max. heap space is reached, at first the VM is doing permanent GC (100% cpu usage) than runs into out of memory

I didn’t have the time to debug the source in order to find the source of the problem. What I discovered is that Hibernate SessionImpl objects accumulate in the heap (I used jvisualvm for that). Each time a JTA transaction is used, SessionImpl instances are left over. This happens only, if transactionalMode in ehcache.xml is set to xa_strict, but it disappears once you set it to xa.

It should be pretty easy to reproduce the problem. If absolutely necessary, I can provide a test-case.

Regards Markus


Markus Menner 2012-03-23

I missed something:

hibernate.transaction.factory_class = ‘org.hibernate.transaction.JTATransactionFactory’

For standalone configuration: hibernate.transaction.manager_lookup_class = ‘org.hibernate.transaction.JOTMTransactionManagerLookup’ For Glassfish configuration: hibernate.transaction.manager_lookup_class = ‘org.hibernate.transaction.SunONETransactionManagerLookup’

And: of course did manual GCs to check whether or not the SessionImpl instances are released from memory.

Fiona OShea 2012-03-23

I’m sending to you, only because it says Hibernate. Not sure if I should send to Ludovic to look at from JTA side.

Let me know if I should re-assign

Alexander Snaps 2012-04-02

Looks like this is comparable to http://forums.terracotta.org/forums/posts/list/6146.page I think this should remain 2.5.2… Assigned to Ludovic who has a patch ready

Ludovic Orban 2012-04-02

I’ve committed a fix for the original forum bug in trunk (r5431). We should now instruct the bug reporter to try the latest nightly build and see if that helps.

Fiona OShea 2012-04-02

Ludovic can you merge to the RC branch - march-madness-rc, as well as 2.5.x?

We don’ t have nightly builds released on the website for trunk feed://download.terracotta.org/rss/terracotta-core.rss

He will need to take a snapshot


Ludovic Orban 2012-04-03

Merged fix into march-madness-rc (r5438) as well as 2.5.x (r5439) branches.