[jboss-jira] [JBoss JIRA] (DROOLS-1655) Memory leak for session object reference even after disposing it

Shailesh T (JIRA) issues at jboss.org
Mon Jul 10 09:48:00 EDT 2017


Shailesh T created DROOLS-1655:
----------------------------------

             Summary: Memory leak for session object reference even after disposing it
                 Key: DROOLS-1655
                 URL: https://issues.jboss.org/browse/DROOLS-1655
             Project: Drools
          Issue Type: Feature Request
    Affects Versions: 6.5.0.Final
            Reporter: Shailesh T
            Assignee: Edson Tirelli
            Priority: Critical


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



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list