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

Bug 1145046

Summary: Task doesn't exit on abortWorkItem in one transaction with Oracle
Product: [Retired] JBoss BPMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: jBPM CoreAssignee: Alessandro Lazarotti <alazarot>
Status: CLOSED EOL QA Contact: Dominik Hanak <dhanak>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.2CC: bpms-support, kverlaen, mbaluch
Target Milestone: ER2   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:07:32 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
jBPM6Ex57_task_parallel_oracle_mvn.zip none

Description Toshiya Kobayashi 2014-09-22 09:29:43 UTC
Created attachment 939936 [details]
jBPM6Ex57_task_parallel_oracle_mvn.zip

Description of problem:

When a Task is added and aborted in one transaction, the Task doesn't exit so left as 'Reserved'. I confirmed this issue with Oracle. A Task properly exits in case of H2 and MySQL.

Steps to Reproduce:

You don't need to set up Oracle. ProcessMainJPATest points at our internal lab Oracle so you can access to it as long as you are inside VPN (the db is slow though).

1. Unzip attached jBPM6Ex57_task_parallel_oracle_mvn.zip
2. Edit pom.xml to meet your filepath of <systemPath> for ojdbc6.jar

    <dependency>
      <groupId>com.oracle</groupId>
      <artifactId>ojdbc6</artifactId>
      <version>11.2.0</version>
      <scope>system</scope>
      <systemPath>/home/tkobayas/workspace711/jBPM6Ex57_task_parallel_oracle_mvn/lib/ojdbc6.jar</systemPath>
    </dependency>

3. mvn test

Actual results:

You will see output like this

A process instance started : pid = 1
Task Entry
A process instance started : pid = 2
taskId = 1, status = Reserved
Task Entry
A process instance started : pid = 3
taskId = 2, status = Reserved
A process instance started : pid = 4
Task Entry
A process instance started : pid = 5
taskId = 3, status = Reserved

This test uses a parallel gateway so sometimes it finishies without adding a Task but you will likely see some "taskId = 2, status = Reserved" logs as it runs with 5 loops.

Expected results:

status is 'Exited'

Comment 1 Toshiya Kobayashi 2014-09-22 09:42:26 UTC
This is likely because of FlushMode.COMMIT which is set in AbstractPersistenceContextManager.getCommandScopedEntityManager().

https://github.com/droolsjbpm/drools/blob/master/drools-persistence-jpa/src/main/java/org/drools/persistence/jpa/AbstractPersistenceContextManager.java#L102

As the flush is deferred to commit, LocalHTWorkItemHandler.abortWorkItem() fails to find the Task.

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-workitems/src/main/java/org/jbpm/services/task/wih/LocalHTWorkItemHandler.java#L98

I observed that MySQL executes insert SQL on em.persist() anyway so this issue is not reproducible with MySQL.

Comment 3 Maciej Swiderski 2014-11-04 11:14:54 UTC
this has been recently enhanced so flush mode will not be set to commit any longer. The change that allowed to do this was to replace entity listeners based callbacks to trigger protobuf serialization with transaction synchronization based. That is coming with next product build so marking it as modified to get retested.

Comment 4 Jiri Svitak 2014-11-27 17:05:19 UTC
Thanks Toshiya for the reproducer!

I have tested this and there is no more status 'Reserved'. Only task id 1 had status 'Exited' as requested:

A process instance started : pid = 1
A process instance started : pid = 2
Task Entry
A process instance started : pid = 3
taskId = 1, status = Exited
A process instance started : pid = 4
A process instance started : pid = 5


Verified in BPMS 6.1.0.ER2.

Maciej, can you please provide commit links with the fix? Thanks.