Bug 999851 - Using three or more identical rules with "forall" causes UnsupportedOperationException
Summary: Using three or more identical rules with "forall" causes UnsupportedOperation...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
urgent
medium
Target Milestone: ER5
: 6.0.0
Assignee: Mario Fusco
QA Contact: Petr Široký
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-22 09:24 UTC by Petr Široký
Modified: 2014-08-06 20:15 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-06 20:15:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DROOLS-283 0 Major Resolved SegmentMemory staged LeftTuples not always accessed correctly 2014-02-21 13:37:09 UTC

Description Petr Široký 2013-08-22 09:24:33 UTC
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 16:30:38 UTC
Created PR with test reproducing the issue: https://github.com/droolsjbpm/drools/pull/240

Comment 2 Mario Fusco 2013-10-03 16:43:53 UTC
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 13:07:39 UTC
Verified fixed in 6.0.0-ER5.


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