Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3583

Retracting an event with an explicit expiration results in memory leak

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

    XMLWordPrintable

Details

    Description

      package drools.tests
      import drools.tests.MyEvent
      import java.util.List
      declare MyEvent @role(event) @expires(14d) end // <====== leaks
      //declare MyEvent @role(event) end // <====== doesn't leak

      rule "UpdateAndRetractOldEvents"
      salience 10000
      when
      $old : MyEvent( $key : key )
      MyEvent( key == $key, this after $old )
      then
      retract( $old );
      System.err.println( "retracted $old" );
      end

      My test case is a loop that does this:

      MyEvent firstA = new MyEvent( "first", "firstA" ); // key, value
      MyEvent firstB = new MyEvent( "first", "firstB" ); // key, value
      ...
      ksession.insert( firstA );
      ksession.fireAllRules();
      Thread.sleep( 50 );
      ksession.insert( firstB );
      ksession.fireAllRules();

      Memory consumption stays flat if MyEvent is declared without an expiration time. Memory consumption increases linearly if MyEvent is declared with an expiration time.

      Attachments

        Activity

          People

            etirelli@redhat.com Edson Tirelli
            ladd_jira Ladd Asper (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty