Bug 1005165

Summary: CCE when using negative patterns without turning on STREAM mode
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas David <tdavid>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.0   
Target Milestone: ER4   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:19:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Winkler 2013-09-06 10:43:44 UTC
Description of problem:

A ClassCastException comes up when using negative patterns without setting event processing mode to STREAM.

This configuration does not really make sense, but a warning or an error indicating what the real problem is should be emitted, instead of a general CCE.

The exception stacktrace:

java.lang.ClassCastException: org.drools.core.reteoo.RuleTerminalNodeLeftTuple cannot be cast to org.drools.core.time.impl.DefaultJobHandle
	at org.drools.core.phreak.PhreakTimerNode.doLeftDeletes(PhreakTimerNode.java:154)
	at org.drools.core.phreak.PhreakTimerNode.doNode(PhreakTimerNode.java:59)
	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:360)
	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:162)
	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:936)
	at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:910)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:233)
	at org.drools.compiler.integrationtests.NegativePatternsTest.testSingleEvent(NegativePatternsTest.java:140)


Version-Release number of selected component (if applicable):

Drools 6.0.0-SNAPSHOT
BRMS 6.0.0-ER2

How reproducible:

Remove line 98: .setEventProcessingMode(EventProcessingOption.STREAM); in the org.drools.compiler.integrationtests.NegativePatternsTest class and run tests from this class.

Comment 1 Mario Fusco 2013-09-13 18:30:22 UTC
It is not possible to raise a compilation error in this case because the EventProcessingMode is a KieBase option and then it is not available at compile time.

What I did is to throw a RuntimeException when you try to create such a kieBase saying:

java.lang.RuntimeException: The requested KieBase "KBase" has been set to run in CLOUD mode but requires features only available in STREAM mode

I added a test case demonstrating this here:

https://github.com/droolsjbpm/drools/blob/69dd8626bb40cd86dd59247a908aa8f212b5eb84/drools-compiler/src/test/java/org/drools/compiler/integrationtests/CepEspTest.java#L3210

Comment 5 Tomas David 2013-10-14 10:08:28 UTC
Verified on BRMS 6.0.0.ER4.