Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1076150

Summary: RETE-OO: NPEs during inserting events from multiple threads
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Edson Tirelli <etirelli>
Status: CLOSED WONTFIX QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: kverlaen, rrajasek, vigoyal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-17 20:09:14 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:
Attachments:
Description Flags
Maven project with reproducer
none
NPEs stacktraces none

Description Marek Winkler 2014-03-13 16:35:49 UTC
Created attachment 874070 [details]
Maven project with reproducer

Description of problem:

When using RETE-OO, one of the following NPEs is thrown during inserting events through different entrypoints using multiple threads.

When using PHREAK, the tests pass with no problems.

There are three different NPEs I have encountered:

- org.drools.reteoo.nodes.ReteAccumulateNode.getFirstMatch(ReteAccumulateNode.java:927)
- org.drools.reteoo.nodes.ReteAccumulateNode.addMatch(ReteAccumulateNode.java:733)
- org.drools.core.base.accumulators.SumAccumulateFunction.reverse(SumAccumulateFunction.java:85)

Please see the attached reproducer for details. I am not sure if this could be considered a blocker, because it seems to have been present in 5.3.1, but at least this should be documented.

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

BRMS 6.0.1 ER2

How reproducible:

Please run 

mvn clean install -Ddrools.ruleEngine=reteoo

in the attached maven project wqith reproducer. There are two tests, illustrating different NPEs. Unfortunately the behaviour is not deterministic, so with different runs you can get a different NPE, or the test may pass. 

We have talked about this with Mario and Davide, and it seems this problem had been fixed in 5.6.0 but the fix cannot be easily ported into 6.0.x.

Actual results:

The tests throw NPEs.

Expected results:

The tests pass as with PHREAK.

Comment 1 Marek Winkler 2014-03-13 16:57:00 UTC
Created attachment 874073 [details]
NPEs stacktraces

Comment 2 Edson Tirelli 2014-03-17 17:19:07 UTC
After further investigation and as discussed with PM/QE, we will not fix this ticket in 6.0.x unless we have a customer requesting it.

The code changes required are not worth the effort, since this is a legacy algorithm and the new algorithm does not have the problem.

Comment 3 Edson Tirelli 2014-03-17 20:09:14 UTC
I am setting the requires_doc_text flag. Please list this ticket as a known bug with the old Rete algorithm. The new algorithm (Phreak) does not have this problem and the switch is recommended to all users.