You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Denis Chudov (Jira)" <ji...@apache.org> on 2021/03/29 13:44:00 UTC
[jira] [Comment Edited] (IGNITE-14425) Hang transactions in FINISH [COMMIT] phase when сommunication spi is blocked
[ https://issues.apache.org/jira/browse/IGNITE-14425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17310659#comment-17310659 ]
Denis Chudov edited comment on IGNITE-14425 at 3/29/21, 1:43 PM:
-----------------------------------------------------------------
[~slava.koptilin] could you pls review this fix?
was (Author: denis chudov):
[~sk0x50] could you pls review this fix?
> 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
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)