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

Unexpected behaviour when using expression in duration-attribute

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.4.0.Final
    • Fix Version/s: None
    • Component/s: drools-core (expert)
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      I have setup a test scenario where incoming events update a fact that maintains an average value. If this average value is greater than a certain threshold for 1 second, a rule triggers (using the duration-attribute). The inserted events are configured to validate the rules condition immediately. When using a literal duration time value, the rule triggers correctly after 1 second. When an expression is used that resolves to a global that contains the same value, the rule triggers only after 20 seconds. (note that 20 events are being inserted). So it seems that an additional delay of 1 second is added to the duration length for each new event.

      Code samples to reproduce this issue can be found here: https://dl.dropbox.com/u/1899207/droolsdurationtest.zip

      Output:
      [1346921201633]: Created event stats intance
      [1346921201638]: Processed new event
      [1346921201830]: Processed new event
      [1346921202030]: Processed new event
      [1346921202229]: Processed new event
      [1346921202430]: Processed new event
      [1346921202630]: Processed new event
      [1346921202640]: duration rule with constant triggered after 1019ms
      [1346921202830]: Processed new event
      [1346921203030]: Processed new event
      [1346921203230]: Processed new event
      [1346921203430]: Processed new event
      [1346921203630]: Processed new event
      [1346921203830]: Processed new event
      [1346921204030]: Processed new event
      [1346921204230]: Processed new event
      [1346921204431]: Processed new event
      [1346921204630]: Processed new event
      [1346921204831]: Processed new event
      [1346921205031]: Processed new event
      [1346921205236]: Processed new event
      [1346921205431]: Processed new event
      [1346921221640]: duration rule with expression triggered after 20019ms

      Show
      I have setup a test scenario where incoming events update a fact that maintains an average value. If this average value is greater than a certain threshold for 1 second, a rule triggers (using the duration-attribute). The inserted events are configured to validate the rules condition immediately. When using a literal duration time value, the rule triggers correctly after 1 second. When an expression is used that resolves to a global that contains the same value, the rule triggers only after 20 seconds. (note that 20 events are being inserted). So it seems that an additional delay of 1 second is added to the duration length for each new event. Code samples to reproduce this issue can be found here: https://dl.dropbox.com/u/1899207/droolsdurationtest.zip Output: [1346921201633] : Created event stats intance [1346921201638] : Processed new event [1346921201830] : Processed new event [1346921202030] : Processed new event [1346921202229] : Processed new event [1346921202430] : Processed new event [1346921202630] : Processed new event [1346921202640] : duration rule with constant triggered after 1019ms [1346921202830] : Processed new event [1346921203030] : Processed new event [1346921203230] : Processed new event [1346921203430] : Processed new event [1346921203630] : Processed new event [1346921203830] : Processed new event [1346921204030] : Processed new event [1346921204230] : Processed new event [1346921204431] : Processed new event [1346921204630] : Processed new event [1346921204831] : Processed new event [1346921205031] : Processed new event [1346921205236] : Processed new event [1346921205431] : Processed new event [1346921221640] : duration rule with expression triggered after 20019ms

      Description

      In some cases the duration-attribute for a rule doesn't behave as would be expected when an expression is used to indicate the duration time (i.e. it triggers too late). When replacing the expression with the equivalent literal value, the rule triggers correctly.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mark.proctor Mark Proctor
                Reporter:
                sarcobe Wannes Kerckhove
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: