Bug 1329735

Summary: java.lang.ClassCastException occurs when building complicated rules containing many eval statements.
Product: [Retired] JBoss BRMS Platform 6 Reporter: Gary Hu <ghu>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: high    
Version: 6.3.0CC: lpetrovi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1330327 (view as bug list) Environment:
Last Closed: 2020-03-27 19:12:56 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:
Bug Depends On:    
Bug Blocks: 1330327, 1330821    

Description Gary Hu 2016-04-22 19:00:01 UTC
The following exception is thrown when building complicated rules containing many eval statements:

java.lang.ClassCastException: xxxxx cannot be cast to xxxx
   at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:123)
   at org.drools.core.phreak.PhreakEvalNode.doLeftInserts(PhreakEvalNode.java:70)
   ...

The root cause could be found from https://issues.jboss.org/browse/DROOLS-1139

"An EvalCondition evaluator needs to be cloned when 2 eval nodes have the same condition, but not the same parent and then cannot be shared. This cloning process is currently incomplete because the eval invoker (generated via ASM) remains the same (same instance) for the 2 evaluators thus resulting in an evaluation with wrong params."

A fix has been submitted in the pull request - https://github.com/droolsjbpm/drools/pull/758

Can we apply this fix to our brms production?

Comment 2 Mario Fusco 2016-04-26 14:33:38 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/8eadcaaff