Memory leak in Infinispan QueryResultsRegionImpl for cacheable Hibernate queries executed outside a transaction in JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 7.2
- Infinispan 9.3
Issue
-
Defined a cacheable query
@NamedQuery(name = "EmployeeQuery", query = "FROM Employee e WHERE e.name = :name", hints = { @QueryHint(name = "org.hibernate.cacheable", value = "true") } ) -
Executing the query outside a transaction
-
Memory usage grows with each query execution as indicated by heap analysis
Class Name | Shallow Heap | Retained Heap | Percentage ----------------------------------------------------------------------------------------------------------------------- org.infinispan.hibernate.cache.v53.impl.QueryResultsRegionImpl @ 0xb7316a80| 56 | 1,024,011,584 | 96.55% |- java.util.concurrent.ConcurrentHashMap @ 0xb7316af0 | 64 | 1,024,011,472 | 96.55% | '- java.util.concurrent.ConcurrentHashMap$Node[524288] @ 0xe0fe2800 | 2,097,168 | 1,024,011,408 | 96.55% | |- java.util.concurrent.ConcurrentHashMap$Node @ 0xbcf1df60 | 32 | 24,672 | 0.00% | |- java.util.concurrent.ConcurrentHashMap$Node @ 0xbcd40238 | 32 | 24,672 | 0.00% | |- java.util.concurrent.ConcurrentHashMap$Node @ 0xb2c1f750 | 32 | 24,672 | 0.00% | |- java.util.concurrent.ConcurrentHashMap$Node @ 0xd707aef8 | 32 | 24,672 | 0.00% | |- java.util.concurrent.ConcurrentHashMap$Node @ 0xbf1e04d0 | 32 | 20,560 | 0.00% ... -----------------------------------------------------------------------------------------------------------------------
Resolution
This issue1 is resolved in This content is not included.EAP 7.2 cumulative patch (CP) 4 and later releases. Production systems should use the latest available cumulative patch.
Root Cause
This is a known defect (Content from issues.jboss.org is not included.ISPN-10323).
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.