aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piergiuseppe Spinelli (JIRA)" <>
Subject [jira] [Created] (ARIES-1767) TransactionControl new transaction isolation among thread
Date Sat, 23 Dec 2017 20:00:00 GMT
Piergiuseppe Spinelli created ARIES-1767:

             Summary: TransactionControl new transaction isolation among thread
                 Key: ARIES-1767
             Project: Aries
          Issue Type: Bug
          Components: tx-control
    Affects Versions: tx-control-0.0.3
         Environment: Karaf 4.2.0.M1, MySql Community Server 5.6.19, Windows 10
            Reporter: Piergiuseppe Spinelli


I'm evaluating the usage of some enterprise features with Karaf.

I wrote a test shell command (attached) in order to check the behavior of TransactionControl
in a multi-threaded environment. 

I read tx-control is Thread Safe, so I wrote the command code for check isolation of new transactions
created for different threads starting by the same injected TransactionControl service.

Now, it is not working as it was intended to. Maybe for my misunderstanding about its usage.

- I use this simple table:
CREATE TABLE `long_term_stata` (
  `VERSION` bigint(20) DEFAULT NULL,
  `STATUS` varchar(255) NOT NULL,
  `PROCESSO` varchar(255) NOT NULL,
  `TARGET` varchar(255) NOT NULL,
  `NOTE` varchar(255) DEFAULT NULL,
  `EXTRA_INFO` longblob,

The command runs N thread performing in a new transaction a "select ... for update" on the
same row, a read of a status, its increment and at the and an updateRow.

I believed the first Thread kept a row write lock and the other ones waited each one to acquire
the row lock until the end of their own transaction. So at the end the counter in the STATUS
field of the table should have been equals to N (the number of threads).

Instead the threads seem to be executed in parallel randomically so that the order of read
& write operations is not respected, ending with a STATUS < N.

If I set the ROW LOCK from another client is seems to work as waited. In MySqlWorkbench:
start transaction;
SELECT * FROM long_term_stata where id=19 for update;

The command waits trying to acquire the row lock until I type a COMMIT in the workbench.

So, my conclusion (but easily I have done some mistake) is that the transaction isolation
does not work properly among threads starting transactions from the same instance of injected

Could you help me confirming if it is a strange behavior or advising for the right way to
write the test?

Thanks in advance

This message was sent by Atlassian JIRA

View raw message