-
Bug
-
Resolution: Done
-
Critical
-
6.5.0.Final
-
None
-
None
-
2017 Week 28-29
-
NEW
-
NEW
Even after closing session, the objects into it are not getting released. This is critical problem when ruls are run on long running server with intermittent use. With huge
number of inserted objects it leaks a considerable memory.
Steps to reproduce:
1) Create a stateful session.
2) Insert huge number of objects into the session.
3) Fire rules.
4) Close session with dispose() call provided.
5) Run GC process.
5) If memory is measured and heap dump is taken it shows that the objects being inserted are still not garbage collected.
Observations:
When walked through heap dump it GC root path looks like
this - value: myPackage.MyObject #1
<- object - class: org.drools.core.common.DefaultFactHandle, value: myPackage.MyObject #1
<- value - class: org.drools.core.util.ObjectHashMap$ObjectEntry, value: org.drools.core.common.DefaultFactHandle #29323
<- [49547] - class: org.drools.core.util.Entry[], value: org.drools.core.util.ObjectHashMap$ObjectEntry #103210
<- table - class: org.drools.core.util.ObjectHashMap, value: org.drools.core.util.Entry[] #8
<- equalityMap - class: org.drools.core.common.ClassAwareObjectStore, value: org.drools.core.util.ObjectHashMap #7
<- objectStore - class: org.drools.core.common.NamedEntryPoint, value: org.drools.core.common.ClassAwareObjectStore #1
<- defaultEntryPoint - class: org.drools.core.impl.StatefulKnowledgeSessionImpl, value: org.drools.core.common.NamedEntryPoint #1
<- value - class: java.util.concurrent.ConcurrentHashMap$HashEntry, value: org.drools.core.impl.StatefulKnowledgeSessionImpl #1
<- [1] - class: java.util.concurrent.ConcurrentHashMap$HashEntry[], value: java.util.concurrent.ConcurrentHashMap$HashEntry #20801
<- table - class: java.util.concurrent.ConcurrentHashMap$Segment, value: java.util.concurrent.ConcurrentHashMap$HashEntry[] #465
<- [14] - class: java.util.concurrent.ConcurrentHashMap$Segment[], value: java.util.concurrent.ConcurrentHashMap$Segment #469
<- segments - class: java.util.concurrent.ConcurrentHashMap, value: java.util.concurrent.ConcurrentHashMap$Segment[] #78
<- kSessions - class: org.drools.compiler.kie.builder.impl.KieContainerImpl, value: java.util.concurrent.ConcurrentHashMap #78
<- compiledRB - class: myPackage.RBInfo, value: org.drools.compiler.kie.builder.impl.KieContainerImpl #1
On further investigations it was found that when new session is create, KieContainerImpl class keeps its reference into 'kSessions' Map. But when session is closed this reference is not released(though such reference is released from KnowledgeBaseImpl).