Issues
- Ensure that thread local for org.hibernate.bytecode.enhance.internal.bytebuddy.SafeCacheProvider + OverridingClassFileLocator are completely clearedHHH-19230Resolved issue: HHH-19230Christian Beikov
- Hibernate Data Repositories are @RequestScopedHHH-19109Resolved issue: HHH-19109Gavin King
- Bytecode enhancement fails when inherited fields are mapped using property access in subclassHHH-19059Resolved issue: HHH-19059Marco Belladelli
- Class Cast Exception for PersistentAttributeInterceptableHHH-19017Resolved issue: HHH-19017jim.simon
- Enum parameters in Jakarta Data repository method return type constructor are not properly matchedHHH-18920Resolved issue: HHH-18920Čedomir Igaly
- Unnecessary joins when use TREAT operatorHHH-18745Resolved issue: HHH-18745Marco Belladelli
- Use stable proxy names to avoid managing proxy state and memory leaksHHH-14694Resolved issue: HHH-14694Christian Beikov
7 of 7
Ensure that thread local for org.hibernate.bytecode.enhance.internal.bytebuddy.SafeCacheProvider + OverridingClassFileLocator are completely cleared
Fixed
Description
Details
Assignee
Christian BeikovChristian BeikovReporter
Scott MarlowScott MarlowComponents
Priority
Major
Details
Details
Assignee
Christian Beikov
Christian BeikovReporter
Scott Marlow
Scott MarlowComponents
Priority
Created March 4, 2025 at 7:24 PM
Updated last month
Resolved March 27, 2025 at 3:25 PM
Activity
Show:
https://issues.redhat.com/browse/WFLY-20430 reports a ThreadLocal leak as described below. We can see that OverridingClassFileLocator#close + SafeCacheProvider#remove are called to remove single classes at a time but clear is never called to remove all classes.
From https://hibernate.zulipchat.com/#narrow/channel/132094-hibernate-orm-dev/topic/WFLY-20430.20.2B.20leak.3F/near/503330528 :
“probably
Enhancer
needs expose a clear method that can be called from theEnhancingClassTransformerImpl
”
Note that
EnhancingClassTransformerImpl
does callbytecodeProvider.resetCaches()
which might be a good place to call Enhancer#clear to clear all from the thread local.Details of the thread local leak copied from WFLY-20430:
Class Name | Referenced Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
org.jboss.threads.JBossThread @ 0xc78b9638 ServerService Thread Pool – 262 Thread| 23,051 | 128 | 1,844,080 | 19,866,856
'- threadLocals java.lang.ThreadLocal$ThreadLocalMap @ 0xcb724348 | 23,051 | 24 | 1,844,080 | 19,866,560
'- table java.lang.ThreadLocal$ThreadLocalMap$Entry[1024] @ 0xc9c995e8 | 23,051 | 4,112 | 1,844,080 | 19,866,536
'- [66] java.lang.ThreadLocal$ThreadLocalMap$Entry @ 0xcc1c3680 | 215 | 32 | 17,200 | 183,128
'- value java.util.HashMap @ 0xcc1c36a0 | 215 | 48 | 17,200 | 183,072
'- table java.util.HashMap$Node[16] @ 0xcc1c36d0 | 215 | 80 | 17,200 | 183,024
|- [3] java.util.HashMap$Node @ 0xce1925f0 | 151 | 32 | 12,080 | 128
|- [11] java.util.HashMap$Node @ 0xce1902f8 | 36 | 32 | 2,880 | 33,048
|- [6] java.util.HashMap$Node @ 0xcb707618 | 25 | 32 | 2,000 | 20,296
|- [13] java.util.HashMap$Node @ 0xcc1c3720 | 3 | 32 | 240 | 3,008
'- Total: 4 entries | | | |
Values for the ^ HashMap$Node entries:
Type|Name |Value
ref |next |null
ref |value|net.bytebuddy.pool.TypePool$Resolution$Simple @ 0xcb3665c8
ref |key |org.jboss.as.test.integration.jpa.hhh18901.Department
int |hash |-1592475309
Type|Name |Value
ref |next |java.util.HashMap$Node @ 0xce192570
ref |value|net.bytebuddy.pool.TypePool$Resolution$Simple @ 0xce190380
ref |key |org.jboss.as.test.integration.jpa.hhh18901.PartTimeEmployee
int |hash |-1974976725
Type|Name |Value
ref |next |null
ref |value|net.bytebuddy.pool.TypePool$Resolution$Simple @ 0xcb707698
ref |key |org.jboss.as.test.integration.jpa.hhh18901.Employee
int |hash |587571174
Type|Name |Value
ref |next |null
ref |value|net.bytebuddy.pool.TypePool$Resolution$Simple @ 0xcc1c37a8
ref |key |org.jboss.as.test.integration.jpa.hhh18901.AbstractPersonnel
int |hash |185882269