Uploaded image for project: 'JBoss BRMS Platform'
  1. JBoss BRMS Platform
  2. RHBRMS-2371

Memory leak in phreak when a newly added fact is removed before a join node having that fact as right input is evaluated

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 6.0.0
    • 6.0.0
    • BRE
    • None

    Description

      When a fact that is the right input of a join node is added and then immediately removed before the join node is evaluated it gets added to the delete staged set of the right memory of that node. If the join node never gets evaluated the right tuple will remain forever in that staged set. Iterating this process with a big numbers of these facts can ultimately lead to a OutOfMemory.

      The following test case reproduces the problem. It doesn't make any assertion so it doesn't fail. Anyway putting a breakpoint in the RightTupleSetsImpl.addDelete method it is possible to see that the set has 100 RightTuple in its staged delete set.

      @Test
      public void testStagedTupleLeak() throws Exception {
      String str =
      "rule R1 when\n" +
      " $i : Integer()\n" +
      "then\n" +
      " insertLogical( $i.toString() );\n" +
      "end\n" +
      "\n" +
      "rule R2 when\n" +
      " $i : Integer()\n" +
      "then\n" +
      " delete( $i );\n" +
      "end\n" +
      "\n" +
      "rule R3 when\n" +
      " $l : Long()\n" +
      " $s : String( this == $l.toString() )\n" +
      "then\n" +
      "end\n";

      KnowledgeBase kbase = loadKnowledgeBaseFromString(str);
      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

      for (int i = 0; i < 100; i++)

      { ksession.insert(i); ksession.fireAllRules(); }

      }

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mfusco@redhat.com Mario Fusco
            Archiver:
            rhn-support-ceverson Clark Everson
            Lukáš Petrovický Lukáš Petrovický (Inactive)
            Lukáš Petrovický Lukáš Petrovický (Inactive)
            etirelli, Rajesh Rajasekaran

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty