Bug 772068 - Running multiple process instances with rule tasks have unexpected results
Summary: Running multiple process instances with rule tasks have unexpected results
Keywords:
Status: NEW
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM Console
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Kris Verlaenen
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-05 21:17 UTC by Jeff DeLong
Modified: 2020-04-27 01:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---


Attachments (Terms of Use)

Description Jeff DeLong 2012-01-05 21:17:39 UTC
Description of problem:

Executing rules from processes started in the jBPM Console is highly erratic. I find if I run start process after process, I get inconsistent and unexpected results. I believe this is probably because there is only a single knowledge session being used by the JBPM Console, and since I insert facts and don't retract them when the process completes, they are still sitting around in working memory.


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

To workaround this problem I created another rule and rule task at the end of the process to retract the facts (I played around with using a script and process variables for the factHandles but this approach was not as easy). I can now run the process multiple times with expected results. 

I think this is a really crude solution, for the user to have to manage fact insertion and retraction from the business process. The fact insertion is somewhat expected, since there is no way for the jBPM Console to know how to create facts from input fields on a form (although this would be a useful extension to the form generation capability). But retracting facts at the end of the process is ugly. This workaround also would not work if there were multiple console users starting processes concurrently.

Instead, I believe the jBPM Console should have each process instance create a new stateful session (or at least make this behavior configurable). Once the process completes, the stateful session should be disposed.

Comment 3 Maciej Swiderski 2012-04-23 16:07:02 UTC
I believe that in some cases this will be desired behavior - to be able to use business rules (from within the process) that depends on external facts.
If reasoning should be done only on internal process instance's facts they should not be inserted into the session but rather rules should be created that operate on process variables and insert only process instance into the session and retract it at the end of the process.

This can be done with on entry and on exits scripts currently but could be a good extension if based on some configuration (on process level) that will instruct the engine to do that automatically: when started, process instance should be inserted into the session; update it in the session when variable changes; and retract it when process instances is completed/aborted.

Wdyt?


Note You need to log in before you can comment on or make changes to this bug.