Bug 1006940

Summary: Process instance is active though the transaction rollback was performed
Product: [Retired] JBoss BPMS Platform 6 Reporter: Ivo Bek <ibek>
Component: jBPM CoreAssignee: Maciej Swiderski <mswiders>
Status: CLOSED NOTABUG QA Contact: Ivo Bek <ibek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0   
Target Milestone: ER4   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-12 08:38:57 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:
Attachments:
Description Flags
StartProcessRollbackTest none

Description Ivo Bek 2013-09-11 14:24:44 UTC
Description of problem:

Seems the start of process is not persisted because if I perform the steps below, the process instance is still active in ksession.

#begin of transaction
#start of process
#rollback
#dispose runtime manager
#create runtime manager with the same identifier to reload the persisted ksession (BTW strategy is SINGLETON)
#get process instance
#check that the process instance is null -- here is the problem because the process instance isn't null


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Ivo Bek 2013-09-11 14:40:07 UTC
Created attachment 796426 [details]
StartProcessRollbackTest

Attached StartProcessRollbackTest. The test uses JbpmJUnitBaseTestCase, so you should be able to test it in jbpm-test module or somewhere you have access to the module. Also use any process definition which stay active after start (e.g. containing a human task)

Comment 2 Maciej Swiderski 2013-09-11 15:36:27 UTC
the reason why the process instance is not rolled back as expected is due to user transaction instance is not the right one:

UserTransaction ut = com.arjuna.ats.jta.UserTransaction.userTransaction();

arjuna transaction is not used in junit testing and thus it will give instance that is not used by the runtime service. With that said even though you call rollback the engine when executing process isntance does not find any active transaction and thus commit it on the end of startProcess operation. To make your test work properly you should replace the line above with:

UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction");

could you please confirm?

Comment 3 Ivo Bek 2013-09-12 07:50:56 UTC
Hi Maciej,

thank you, I recycled the tests for transactions from BRMS 5.x, so has this changed meantime? After the change to use InitialContext.doLookup("java:comp/UserTransaction"); the test works.

Comment 4 Maciej Swiderski 2013-09-12 08:34:23 UTC
Ivo, thanks for confirmation. 

As far as I can tell, nothing has changed in this regard. JUnit tests were always relying on UserTransaction taken from JNDI and never used arjuna for any sort of transaction operations. bitronix is used in tests and it does bind UserTransaction into JNDI.

I believe then this issue can be closed, wdyt?

Comment 5 Ivo Bek 2013-09-12 08:38:57 UTC
Then I have no idea how it appeared there :). Yes, we can close it since there is nothing to be fixed.