Maksim Zhuravkov created IGNITE-20534:
-----------------------------------------

             Summary: Transactions. It is possible to call enlist on a 
rollbacked transaction and cause resource leak.
                 Key: IGNITE-20534
                 URL: https://issues.apache.org/jira/browse/IGNITE-20534
             Project: Ignite
          Issue Type: Improvement
    Affects Versions: 3.0.0-beta2
            Reporter: Maksim Zhuravkov


It is possible to rollback a transaction, invoke a modification operation, open 
another transaction and get 'Failed to acquire a lock due to a conflict' when 
accessing that table.

Reproducer:

{code:java}
 @Test
    public void testLockIsNotReleasedAfterTxRollback() {
        Ignite ignite = CLUSTER_NODES.get(0);
        IgniteSql sql = ignite.sql();

        try (Session ses = ignite.sql().createSession()) {
            ses.execute(null, "CREATE TABLE IF NOT EXISTS tst(id INTEGER 
PRIMARY KEY, val INTEGER)").affectedRows();
        }

        try (Session session = sql.createSession()) {
            Transaction tx = ignite.transactions().begin();

            assertThrows(RuntimeException.class, () -> session.execute(tx, 
"SELECT 1/0"));

            tx.rollback();

            session.execute(tx, "INSERT INTO tst VALUES (1, 1)"); // if this 
line is commented out, everything works fine.
        }

        try (Session session = sql.createSession()) {
            Transaction tx = ignite.transactions().begin(new 
TransactionOptions().readOnly(false));

            session.execute(tx, "INSERT INTO tst VALUES (1, 1)"); //IGN-TX-4 
TraceId:20441aa3-c3fb-4900-a78f-b2cb4585e314 Failed to acquire a lock due to a 
conflict [txId=018af087-fb6b-0000-0000-0000e9bae05c, 
conflictingWaiter=WaiterImpl [txId=018af087-f595-0000-0000-0000e9bae05c, 
intendedLockMode=null, lockMode=X, ex=null, isDone=true]]

            tx.commit(); 
        }
    }
{code} 







--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to