Bug 999851 - Using three or more identical rules with "forall" causes UnsupportedOperationException
Using three or more identical rules with "forall" causes UnsupportedOperation...
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.0.0
Unspecified Unspecified
urgent Severity medium
: ER5
: 6.0.0
Assigned To: Mario Fusco
Petr Široký
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-22 05:24 EDT by Petr Široký
Modified: 2014-08-06 16:15 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:15:38 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker DROOLS-283 Major Resolved SegmentMemory staged LeftTuples not always accessed correctly 2014-02-21 08:37:09 EST

  None (edit)
Description Petr Široký 2013-08-22 05:24:33 EDT
Description of problem:
Using three or more identical rules (with just different name) that contain "forall" causes UnsupportedOperationException after calling fireAllRules(). It does not really makes sense to create identical rules, but I think the engine should cope with that and don't throw exception.

E.g:
rule "All objects are equal_1"
when
    forall ($obj : Object()
            Object(this == $obj)
    )
then
end

rule "All objects are equal_2"
when
    forall ($obj : Object()
            Object(this == $obj)
    )
then
end

rule "All objects are equal_3"
when
    forall ($obj : Object()
            Object(this == $obj)
    )
then
end


Full stracktrace:
java.lang.UnsupportedOperationException
  at org.drools.core.reteoo.BaseLeftTuple.getBlocker(BaseLeftTuple.java:532)
  at org.drools.core.phreak.PhreakNotNode.doLeftInserts(PhreakNotNode.java:102)
  at org.drools.core.phreak.PhreakNotNode.doNode(PhreakNotNode.java:69)
  at org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:553)
  at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:530)
  at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:335)
  at org.drools.core.phreak.RuleNetworkEvaluator.evalStackEntry(RuleNetworkEvaluator.java:231)
  at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:167)
  at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:117)
  at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:205)
  at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:65)
  at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:936)
  at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1183)
  at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:928)
  at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:902)
  at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:233)


Note that the exception is only thrown when there are three or more of these identical rules (I could not reproduce it with one or two) and also I have been able to reproduce it only when using "forall", but it is possible that it could be happening using also other constructs.

I will create PR with test reproducing the issue asap.


Version-Release number of selected component (if applicable):
6.0.0-ER1 (and community 6.1.0-SNAPSHOT, 6.0.0-SNAPSHOT)


How reproducible:
Always


Steps to Reproduce:
1. Build kbase from the above rules.
2. Create ksession and call fireAllRules()


Actual results:
UnsupportedOperationException.


Expected results:
Successful execution.
Comment 1 Petr Široký 2013-08-22 12:30:38 EDT
Created PR with test reproducing the issue: https://github.com/droolsjbpm/drools/pull/240
Comment 2 Mario Fusco 2013-10-03 12:43:53 EDT
This issue has been fixed by Mark with this commit: https://github.com/droolsjbpm/drools/commit/eca450ead

I pushed a test case demonstrating that it is working now: https://github.com/droolsjbpm/drools/commit/116bee5bf
Comment 6 Petr Široký 2013-11-25 08:07:39 EST
Verified fixed in 6.0.0-ER5.

Note You need to log in before you can comment on or make changes to this bug.