Memory leak in Infinispan QueryResultsRegionImpl for cacheable Hibernate queries executed outside a transaction in JBoss EAP

Solution Verified - Updated -

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%
          ...
    -----------------------------------------------------------------------------------------------------------------------
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.2
  • Infinispan 9.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content