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

Bug 1138412

Summary: MortgageApplication process IllegalStateException: We cannot have more than one BAM Task Summary for the task id = 3
Product: [Retired] JBoss BPMS Platform 6 Reporter: Jiri Svitak <jsvitak>
Component: jBPM CoreAssignee: Alessandro Lazarotti <alazarot>
Status: CLOSED EOL QA Contact: Marek Baluch <mbaluch>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0.2CC: agiertli, kverlaen, mbaluch, rrajasek, rzhang
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1206667 (view as bug list) Environment:
Last Closed: 2020-03-27 20:09:23 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: 1206667    
Attachments:
Description Flags
server.log
none
mortgage.png none

Description Jiri Svitak 2014-09-04 18:17:47 UTC
Created attachment 934582 [details]
server.log

I have run a MortgageApplication process of official BPM Example in business-central. I chose the process parameter combination so the process enters data correction human task, activates swimlane, then goes to appraisal task out of swimlane and later to 'increase down payment task' back into the swimlane. However the third task produces the following error on start operation (claim is not necessary as the claim operation was done on the first data correction task in the same swimlane):

19:14:46,932 WARN  [org.jbpm.services.task.audit.lifecycle.listeners.BAMTaskEventListener] (http-localhost.localdomain/127.0.0.1:8080-3) Something went wrong with the Task BAM Listener
19:14:46,933 WARN  [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http-localhost.localdomain/127.0.0.1:8080-3) Could not commit session: java.lang.IllegalStateException: We cannot have more than one BAM Task Summary for the task id = 9
	at org.jbpm.services.task.audit.lifecycle.listeners.BAMTaskEventListener.createOrUpdateTask(BAMTaskEventListener.java:258) [jbpm-human-task-audit-6.0.3-redhat-5.jar:6.0.3-redhat-5]

To reproduce:
1.) Setup BPMS 6.0.3.ER1 (http://dev138.mw.lab.eng.bos.redhat.com/candidate/bpms-6.0.3-ER1/) on EAP 6.1.2 (http://download.eng.brq.redhat.com/released/JBEAP-6/6.1.2/).
2.) Configure user guest with password guest, see hint below:
guest=b5d048a237bfd2874b6928e1f37ee15e
guest=admin,appraiser,broker,manager
3.) Setup official BPM example, you need to clone its repository to business-central:
http://git.app.eng.bos.redhat.com/git/jboss-bpm-example-app.git/tree/mortgage-demo-repo/src/main/resources/mortgage-demo
and also deploy its web service to EAP:
http://git.app.eng.bos.redhat.com/git/jboss-bpm-example-app.git/tree/mortgage-demo-ws
Or check the official BPM Example Application documentation.
4.) Start the BPMS.
5.) Run the remote test:
git clone git://git.app.eng.bos.redhat.com/jbossqe-process-flood.git
cd jbossqe-process-flood
git checkout bpms-6.0.x
mvn clean test -Dtest=MortgageApplicationBasicRestTest -Dmaven.test.skip=false

Expected behavior:
I do not understand where is the problem with BAM Task Summary, when this task is entered for the first time. Even if it would entered multiple times, this should not happen. The third task should be able to start without any problems.

My env:
BPMS 6.0.3.ER1
EAP 6.1.2
PostgreSQL 9.3.5

Comment 1 Jiri Svitak 2014-09-04 18:19:55 UTC
Created attachment 934583 [details]
mortgage.png

The process model view of the flow I tried to achieve. The third task 'increase down payment' cannot be started and throws an exception.

Comment 2 Kris Verlaenen 2014-09-04 19:27:38 UTC
Jiri, is it possible the database contained old information in the database (from previous executions)?

Comment 3 Jiri Svitak 2014-09-04 20:16:49 UTC
I had this in mind. The steps above are reproducible on empty database.

Comment 4 Jiri Svitak 2014-09-04 20:24:41 UTC
I see that I posted in the bug description wrong log lines with 'id = 9'. However that does not matter, the problem remains also on empty database and the attached server log has it right with 'id = 3', which corresponds to third task on empty database.

Comment 5 Maciej Swiderski 2014-09-16 12:04:22 UTC
changed applied to ensure that current transaction entities are managed by the listeners that depend on JPA queries. JPA queries will not find current transaction entities due to default (enforced by jbpm/drools persistence logic) flush mode set to COMMIT.
That was preventing BAM listener to find the task that was first added and the auto claimed within same transaction and thus creating two entries for the same task.

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/d7065d5f4b509ac44dfd1bc3b91b058ecc66d308

Comment 6 Jiri Svitak 2014-11-19 11:59:55 UTC
Verified in BPMS 6.1.0.ER2.