AnsweredAssumed Answered

conflicts in database connections in JTA

Question asked by tbee on Sep 20, 2012
Latest reply on Oct 2, 2012 by tbee
I've got a setup where business model and Activiti are mixed into one engine. In order to facilitate transactional consistency, Bitronix JTA-XA is used to enabled distributed transactions. Configuration wise this works, however during the execution of a Activiti listener the connections have a conflict: the execution freezes and after a while a time out occurs. This looks very similar to a locking conflict.

In order to examine this, I've logged all changes that Activiti makes to the database:

169: [EL Finer]: 2012-09-20 14:08:17.962–ClientSession(5578877)–Thread(Thread[main,5,main])–TX beginTransaction, status=STATUS_ACTIVE
306: 2012-09-20 14:08:20,448 DEBUG #5958562[C22645161] activiti: execute: update ACT_GE_PROPERTY     …
334: 2012-09-20 14:08:20,495 DEBUG #10522721[C5094311] activiti: execute: insert into ACT_RU_EXECUTION …
360: 2012-09-20 14:08:20,495 DEBUG #25022548[C5094311] activiti: execute: insert into ACT_HI_PROCINST …
384: 2012-09-20 14:08:20,511 DEBUG #13502571[C5094311] activiti: execute: insert into ACT_HI_ACTINST …
408: 2012-09-20 14:08:20,526 DEBUG #25489800[C5094311] activiti: execute: insert into ACT_RU_VARIABLE …
432: 2012-09-20 14:08:20,542 DEBUG #28968689[C5094311] activiti: execute: insert into ACT_RU_VARIABLE …
456: 2012-09-20 14:08:20,542 DEBUG #9486511[C5094311] activiti: execute: insert into ACT_HI_ACTINST …
486: 2012-09-20 14:08:20,557 DEBUG #4047039[C5094311] activiti: execute: insert into ACT_RU_TASK …
520: 2012-09-20 14:08:20,573 DEBUG #2157445[C5094311] activiti: execute: insert into ACT_HI_TASKINST …
534: 2012-09-20 14:08:20,589 DEBUG #22864626[C5094311] activiti: execute: insert into ACT_RU_IDENTITYLINK …
674: [EL Finer]: 2012-09-20 14:08:20.714–UnitOfWork(30281720)–Thread(Thread[main,5,main])–TX afterCompletion callback, status=COMMITTED
676: —————————
677: [EL Finer]: 2012-09-20 14:08:20.729–ClientSession(5578877)–Thread(Thread[main,5,main])–TX beginTransaction, status=STATUS_ACTIVE
741: 2012-09-20 14:08:20,808 DEBUG #17985579[C5094311] activiti: execute: update ACT_RU_TASK …
769: 2012-09-20 14:08:20,823 DEBUG #32139235[C5094311] activiti: execute: update ACT_HI_TASKINST …
781: 2012-09-20 14:08:20,823 DEBUG #28336320[C5094311] activiti: execute: update ACT_HI_ACTINST …
877: 2012-09-20 14:08:20,901 DEBUG #28860947[C22645161] activiti: execute: insert into ACT_RU_VARIABLE …
913: 2012-09-20 14:08:20,917 DEBUG #9528986[C5094311] activiti: execute: insert into ACT_RU_EXECUTION …
937: 2012-09-20 14:08:20,933 DEBUG #33054865[C5094311] activiti: execute: insert into ACT_HI_ACTINST …
961: 2012-09-20 14:08:20,948 DEBUG #21289936[C5094311] activiti: execute: insert into ACT_HI_ACTINST …
991: 2012-09-20 14:08:20,980 DEBUG #23935686[C5094311] activiti: execute: insert into ACT_RU_TASK …
1025: 2012-09-20 14:08:20,995 DEBUG #31851612[C5094311] activiti: execute: insert into ACT_HI_TASKINST …

Important is the number in square brackets which denotes the JDBC connection used. What I notice is that almost all interaction is done through [C5094311], except three which use [C22645161]. Now, prefix 408 and 432 and 877 use the same table through different connections. 877 is the result of this line:


      ProcessEngines.getDefaultProcessEngine().getRuntimeService().setVariable( getWorkflowProcessInstance().getProcessInstanceId(), "validateOfferStage", Long.valueOf(System.currentTimeMillis()));

And indeed, if i comment this out, the executions continues. Why are there different database connections being used to write to the database?

Outcomes