Bug 1006940 - Process instance is active though the transaction rollback was performed
Process instance is active though the transaction rollback was performed
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: jBPM Core (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ER4
: 6.0.0
Assigned To: Maciej Swiderski
Ivo Bek
Depends On:
  Show dependency treegraph
Reported: 2013-09-11 10:24 EDT by Ivo Bek
Modified: 2013-09-12 04:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-12 04:38:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
StartProcessRollbackTest (2.08 KB, text/x-java)
2013-09-11 10:40 EDT, Ivo Bek
no flags Details

  None (edit)
Description Ivo Bek 2013-09-11 10:24:44 EDT
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
#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:

Actual results:

Expected results:

Additional info:
Comment 1 Ivo Bek 2013-09-11 10:40:07 EDT
Created attachment 796426 [details]

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 11:36:27 EDT
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 03:50:56 EDT
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 04:34:23 EDT
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 04:38:57 EDT
Then I have no idea how it appeared there :). Yes, we can close it since there is nothing to be fixed.

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