[ 
https://issues.apache.org/jira/browse/IGNITE-27904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18069632#comment-18069632
 ] 

Denis Chudov commented on IGNITE-27904:
---------------------------------------

Reproducer (flaky, sometimes fails on tx state check):
{code:java}
@Test
public void test() throws InterruptedException, NoSuchFieldException, 
IllegalAccessException {
    IgniteImpl crd = anyNode();

    RecordView<Tuple> view = crd.tables().table(TABLE_NAME).recordView();

    Transaction tx = crd.transactions().begin();
    Tuple t = INITIAL_TUPLE;

    UUID txId = txId(tx);

    log.info("qqq txId=" + txId);

    for (int i = 0; i < 40; i++) {
        t = NEXT_TUPLE.apply(t);
        view.upsert(tx, t);
    }

    crd.txManager().updateTxMeta(txId, old -> null);

    int tableId = table(crd, TABLE_NAME).tableId();

    IgniteImpl anotherNode = findNode(n -> !n.name().equals(crd.name()));

    Tuple nt = findTupleToBeHostedOnNode(anotherNode, TABLE_NAME, tx, 
INITIAL_TUPLE, NEXT_TUPLE, true);
    ZonePartitionId partId = new ZonePartitionId(zoneId(crd, TABLE_NAME), 
partitionIdForTuple(crd, TABLE_NAME, nt, tx));

    var nodes = 
runningNodes().map(TestWrappers::unwrapIgniteImpl).collect(toList());

    transferPrimary(nodes, partId);

    view.upsert(null, nt);

    sleep(2000);

    TxState txState = null;
    for (IgniteImpl n : nodes) {
        TxStateMeta meta = n.txManager().stateMeta(txId);
        if (meta != null && isFinalState(meta.txState())) {
            txState = meta.txState();
            break;
        }
    }

    assertEquals(ABORTED, txState);

    await().timeout(60, TimeUnit.SECONDS).until(() -> {
        boolean found = false;
        for (IgniteImpl n : nodes) {
            var prl = partitionReplicaListener(n, partId, tableId);
            Field field = 
PartitionReplicaListener.class.getDeclaredField("txCleanupReadyFutures");
            field.setAccessible(true);
            Map<UUID, ?> txCleanupReadyFutures = (Map<UUID, ?>) field.get(prl);
            if (txCleanupReadyFutures.containsKey(txId)) {
                found = true;
                break;
            }
        }

        return !found;
    });
} {code}

> Potential memory leak in tx cleanup ready states
> ------------------------------------------------
>
>                 Key: IGNITE-27904
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27904
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Denis Chudov
>            Priority: Major
>              Labels: ignite-3
>
> [1] is cleaned up only on txn write intent switch, but this is happy path. In 
> case of transaction recovery, it can't happen at all, so the map entry will 
> remain there until node restarts.
> Need to clean it up properly (e.g. during vacuum).
> [1 PartitionReplicaListener#txCleanupReadyFutures



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

Reply via email to