You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Denis Chudov (Jira)" <ji...@apache.org> on 2021/03/26 09:16:00 UTC
[jira] [Created] (IGNITE-14425) Hang transactions in FINISH [COMMIT] phase when сommunication spi is blocked
Denis Chudov created IGNITE-14425:
-------------------------------------
Summary: Hang transactions in FINISH [COMMIT] phase when сommunication spi is blocked
Key: IGNITE-14425
URL: https://issues.apache.org/jira/browse/IGNITE-14425
Project: Ignite
Issue Type: Bug
Reporter: Denis Chudov
Assignee: Denis Chudov
scenario:
From a client for two concurrent transactions on a single key.
At the same time, the GridNearTxFinishRequest message is blocked from the client, a partial network failure is emulated, as a result, one of the transactions is not completed even if the node is no longer working
Reproducer:
(insert this test into *TxRollbackOnTimeoutTest*)
{code:java}
/**
*
*/
@Test
public void testRollbackOnNearNodeLeft() throws Exception {
Ignite client = startClient();
Integer pk = primaryKey(grid(0).cache(CACHE_NAME));
CountDownLatch locked = new CountDownLatch(1);
CountDownLatch blocked = new CountDownLatch(1);
IgniteInternalFuture<Void> fut = runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
try (Transaction tx0 = client.transactions().txStart()) {
client.cache(CACHE_NAME).put(pk, 0);
locked.countDown();
U.awaitQuiet(blocked);
tx0.commit();
}
catch (Exception e) {
// Ignored.
}
return null;
}
});
IgniteInternalFuture fut2 = runAsync(new Runnable() {
@Override public void run() {
try (Transaction tx1 = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 1000, 0)) {
U.awaitQuiet(locked);
TestRecordingCommunicationSpi.spi(client).blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
@Override public boolean apply(ClusterNode clusterNode, Message msg) {
return msg instanceof GridNearTxFinishRequest;
}
});
TestRecordingCommunicationSpi.spi(grid(0)).blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
@Override public boolean apply(ClusterNode clusterNode, Message msg) {
return msg instanceof GridNearLockResponse;
}
});
client.cache(CACHE_NAME).put(pk, 1);
fail();
}
catch (Exception e) {
assertTrue(X.hasCause(e, TransactionTimeoutException.class));
}
}
});
TestRecordingCommunicationSpi.spi(client).waitForBlocked();
TestRecordingCommunicationSpi.spi(grid(0)).waitForBlocked();
fut2.get();
client.close();
TestRecordingCommunicationSpi.spi(grid(0)).stopBlock();
blocked.countDown();
fut.get();
assertTrue(grid(0).context().cache().context().tm().activeTransactions().isEmpty());
}
{code}
As the result, transaction hangs on server node in MARKED_ROLLBACK state forever.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)