Bug 1328380

Summary: Node Hashing with type mismatch condition results in silent misfiring
Product: [Retired] JBoss BRMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: etirelli, hmiura, mfusco
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1329725 1329771 (view as bug list) Environment:
Last Closed: 2020-03-27 19:09:29 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:
Bug Depends On:    
Bug Blocks: 1329725, 1329771    

Description Toshiya Kobayashi 2016-04-19 09:10:04 UTC
Description of problem:

If you have 2 rules with type mismatch condition (Person.status is String),

=====
rule "rule1"
    when
        Person(status == 1)
    then
        System.out.println( "rule1" );
end

rule "rule2"
    when
        Person(status == 2)
    then
        System.out.println( "rule2" );
end
=====

Person with status "1" hits "rule1" thanks to Mvel coercion.

=====
Person p = new Person();
p.setStatus("1");
kSession.insert(p);
kSession.fireAllRules();
=====

However, if you have 3 rules,

=====
rule "rule1"
    when
        Person(status == 1)
    then
        System.out.println( "rule1" );
end

rule "rule2"
    when
        Person(status == 2)
    then
        System.out.println( "rule2" );
end

rule "rule3"
    when
        Person(status == 3)
    then
        System.out.println( "rule3" );
end
=====

Person with status "1" doesn't hit "rule1".


Steps to Reproduce:
1. I'm going to send a test case PR.

Actual results:

"rule1" is not fired.

Expected results:

"rule1" is fired

or

give an error or warning.

Comment 2 Toshiya Kobayashi 2016-04-19 09:17:47 UTC
Sent a test case PR:
https://github.com/droolsjbpm/drools/pull/745

Comment 3 Mario Fusco 2016-04-20 13:26:28 UTC
Fixed by https://github.com/droolsjbpm/drools/compare/5801072...434c6e2

Comment 7 Mario Fusco 2016-04-26 08:18:55 UTC
Cherry-picked to branch 6.4.x with https://github.com/droolsjbpm/drools/compare/d2391b0...58ddfd1