Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1655

Memory leak for session object reference even after disposing it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 7.2.0.Final
    • 6.5.0.Final
    • None
    • None
    • 2017 Week 28-29
    • NEW
    • NEW

    Description

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

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            stamboli_jira Shailesh T (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: