[rules-users] 6.1.0.beta4 and identified a rule pattern inducing memory leaks

Matteo Mortari matteo.mortari at gmail.com
Thu Jun 5 05:57:49 EDT 2014


Ciao, I'm using 6.1.0.beta4 and I identified in my application a rule
pattern inducing memory leaks. I try to attach rule, screenshots,
and javacode to replicate the issue.

IF the rule "After No data received within the last 1 hour Error, now
resumed" is included, memory leaks happens, and pretty quickly.
IF such rule is commented out, application do manage to keep alive.

[>] Question kindly is: is this normal on 6.1.0.beta4, or shall I go ahead
and raise a JIRA for this, please?

This time I ask in the mailinglist first, just because last time I
experienced a similar issue and raised JIRA, but in fact at the end was
just another way to replicate a known issue.

Thank you in advance
Ciao,
MM
*package* com.acme.drools6test.anotherleak;



*import* com.acme.objectmodel.*



// we take time is insertion time of SensorReading

*declare* SensorReading

      @role(event)

*end*



*declare* Alert

      @role(event)

*end*



*declare* AlertErrorToken

      @role(event)

      @timestamp(ts)

      ts : *long*

*end*



*declare* AMap

      @role(fact)

      map : java.util.HashMap

*end*



*query* "AMap"

      $AMap : AMap()

*end*



*query* "Alerts"

      $alert : Alert()

*end*



*query* "All"

      $o : Object()

*end*





*rule* "init AMap"

*no-loop*

*when*

      *not* ( AMap() )

*then*

      AMap t = *new* AMap();

      t.setMap( *new* java.util.HashMap() );

      *insert*( t );

*end*



*rule* "to display a kind of single table that list most recent value"

*no-loop*

*when*

      $sr : SensorReading($id : header.id , $value : value)

      AMap($map : map)

*then*

      $map.put($id, $value);

*end*



*rule* "No data received within the last 1 minutes Warning"

*no-loop*

*when*

      $sr : SensorReading()

      *not*( SensorReading( *this* != $sr, *this* after[0,1m] $sr ) )

      *not*( Alert( sr == $sr, type == AlertType.WARNING ) )

*then*

      Alert alert = *new*
Alert(kcontext.getKieRuntime().getSessionClock().getCurrentTime(), "No data
received within the last 1 minutes",   AlertType.WARNING, $sr);

      *insert*(alert);

      System.out.println("1 minutes Warning insert " + alert);



      // send WARNING notification

*end*



*rule* "No data received within the last 1 hour Error"

*no-loop*

*when*

      $sr : SensorReading()

      *not*( SensorReading( *this* != $sr, *this* after[0,1h] $sr ) )

      *not*( Alert( sr == $sr, type == AlertType.ERROR ) )

*then*

      *long* errTs =
kcontext.getKieRuntime().getSessionClock().getCurrentTime();

      Alert alert = *new* Alert(errTs, "No data received within the last 1
hour",      AlertType.ERROR, $sr);

      *insert*(alert);

      AlertErrorToken errToken = *new* AlertErrorToken();

      errToken.setTs(errTs);

      *insert*(errToken);

      System.out.println("last 1 hour Error insert " + alert);



      // send ERROR notification

*end*



*rule* "After No data received within the last 1 hour Error, now resumed"

*no-loop*

*when*

      $errToken : AlertErrorToken()

      $errAlert : Alert(*this* coincides $errToken)

      SensorReading( *this* after $errToken )

*then*

      *retract*($errToken);

      System.out.println("now resumed retract " + $errToken);



      // send INFO resume notification

*end*



*rule* "Housekeep rule"

*salience* -1000

*no-loop*

*dialect* "mvel"

*when*

    $last : SensorReading( )  over window:length( 1 )

    $earlier : SensorReading( *this* before $last, *this* != $last )

*then*

    *retract*($earlier);

    System.out.println("Housekeep : "+$earlier);

*end*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140605/068ff129/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Java_VisualVM_2014-06-05_11-38-12.png
Type: image/png
Size: 121616 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20140605/068ff129/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Java_VisualVM_2014-06-05_11-43-06.png
Type: image/png
Size: 112279 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20140605/068ff129/attachment-0003.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20140604.anotherleak.zip
Type: application/zip
Size: 6494 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20140605/068ff129/attachment-0001.zip 


More information about the rules-users mailing list