Bug 724234 (BRMS-178)

Summary: update(fact) doesn't work in ruleflow
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: nwallace <nwallace>
Component: unspecifiedAssignee: Kris Verlaenen <kris.verlaenen>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: urgent    
Version: unspecified   
Target Milestone: ---   
Target Release: 5.0.1   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/BRMS-178
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-01 12:27:45 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:

Description nwallace 2009-07-07 15:17:14 UTC
Date of First Response: 2009-09-10 01:29:29
Workaround: Workaround Exists
Workaround Description: As a workaround one can do (in a on-exit action):
drools.getIdentityMap().put(someFact, drools.getWorkingMemory().getFactHandle(someFact));
and then it is safe to call
update(someFact);
securitylevel_name: Public

Hi,
org.drools.base.DefaultKnowledgeHelper uses newly added identityMap to keep track of fact handles. It looks like this identityMap is updated before a rule's consequence is called. However it is not updated before a Drools Flow on-exit action. This means that calling update(someFact) in a on-exit ruleflow action causes exception ("org.drools.FactException: Update error: handle not found for object: XXXXX. Is it in the working memory?"). 

this was tested on drools-core-5.0.0.20090417.044049-485.jar

Thanking you in advance.
Best Regards,
Michal

Comment 1 nwallace 2009-07-07 15:18:32 UTC
Link: Added: This issue is related to JBRULES-2077


Comment 2 nwallace 2009-09-01 12:27:45 UTC
Fix in place.

Comment 3 David Le Sage 2009-09-10 05:29:29 UTC
For documenting this in the Release Notes, can you please confirm the following and fill in the missing information. Dot point explanations are fine:

The CAUSE (what was actually broken)
 * the org.drools.base.DefaultKnowledgeHelper's identityMap was not updating before a Drools Flow "on-exit action" occurred.

CONSEQUENCES of the bug (how it impacts users.)
 * This meant that calling update(someFact) in an on-exit ruleflow action caused an exception error.

The FIX (what was changed to eliminate this bug) and 
 *

RESULTS of the fix (what now happens for users.)
 * 

Comment 4 David Le Sage 2009-09-23 05:40:16 UTC
We are still awaiting the outstanding information for the Release Notes on this one.  Please provide it as soon as possible. Thanks.

Comment 5 Kris Verlaenen 2009-09-23 13:06:13 UTC
The CAUSE (what was actually broken)
 * the org.drools.base.DefaultKnowledgeHelper's identityMap was not updating before a Drools Flow "on-exit action" occurred.

CONSEQUENCES of the bug (how it impacts users.)
 * This meant that calling update(someFact) in an on-exit ruleflow action caused an exception error.

The FIX (what was changed to eliminate this bug) and
 * making sure the identityMap is updated before on-exit actions are called

RESULTS of the fix (what now happens for users.)
 * update(fact) can now also be used in on-exit actions