]
Jesus Salvo commented on HHH-2169:
----------------------------------
This is probably the same issue as HHH-3028
L2 Cache and Long transactions Memory Leak : OutOfMemoryException
-----------------------------------------------------------------
Key: HHH-2169
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2169
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.ga
Environment: [b]Hibernate version:[/b]
Hibernate Entity Manager 3.2.0, with Hibernate Core 3.2.0 and Hibernate Annotations
3.2.0
[b]Mapping documents:[/b]
Annotations
[b]Full stack trace of any exception that occurs:[/b]
Memory Heap Exception
[b]Name and version of the database you are using:[/b]
PosgreSQL 8.1
Reporter: Sami Dalouche
Summary
---------
When enabling L2 Cache (with either OScache and EhCache, both with a limitation on the
max #of instances, so the problem shouldn't come from the cache manager), Hibernate
cannot have long running transactions, otherwise, it results in a Memory Heap
Exception...
The problem does NOT happen if the L2 Cache is disabled !
Details
----------
- Configure the code to run in ONE transaction
- Have a huge loop that inserts 2 million entries that are cacheable (@Cache(usage =
CacheConcurrencyStrategy.NONSTRICT_READ_WRITE))
- flush() and clear() every 1000 entries, to periodically flush the cache
=> None of the entries are garbage collected.
=> Using a profiler, it is possible to trace the owning objects of my domain classes
to :
- org.hibernate.action.EntityInsertAction ("instance" variable)
- array / List (variable elementData)
- variable "executions" in object .. class org.hibernate.engine.ActionQueue
Remarks :
- If the Query Cache is disabled, and the objects being inserted are NOT cacheable (no
@Cache annotation), there is no problem
- If the Query Cache is enabled, then, no matter whether the objects being inserted are
cacheable or not, The entries are never garbage collected, and I get an
OutOfMemoryException. (I see NO relationship between the Query Cache and my objects. I
never query the objects, only save them !!)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: