From issues-return-55457-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Thu Jan 18 07:36:09 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id A7B8A180654 for ; Thu, 18 Jan 2018 07:36:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 97A31160C36; Thu, 18 Jan 2018 06:36:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B754D160C2B for ; Thu, 18 Jan 2018 07:36:08 +0100 (CET) Received: (qmail 25720 invoked by uid 500); 18 Jan 2018 06:36:07 -0000 Mailing-List: contact issues-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list issues@ignite.apache.org Received: (qmail 25711 invoked by uid 99); 18 Jan 2018 06:36:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jan 2018 06:36:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 6947F1A654C for ; Thu, 18 Jan 2018 06:36:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.711 X-Spam-Level: X-Spam-Status: No, score=-100.711 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 2dcpi1g53BUr for ; Thu, 18 Jan 2018 06:36:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 08E035FE62 for ; Thu, 18 Jan 2018 06:36:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 90715E260C for ; Thu, 18 Jan 2018 06:36:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id AD10321318 for ; Thu, 18 Jan 2018 06:36:01 +0000 (UTC) Date: Thu, 18 Jan 2018 06:36:01 +0000 (UTC) From: "Vladimir Ozerov (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (IGNITE-6405) Deadlock is not detected if timed out on client. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Auto-Submitted: auto-generated [ https://issues.apache.org/jira/browse/IGNITE-6405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vladimir Ozerov updated IGNITE-6405: ------------------------------------ Fix Version/s: (was: 2.4) 2.5 > Deadlock is not detected if timed out on client. > ------------------------------------------------ > > Key: IGNITE-6405 > URL: https://issues.apache.org/jira/browse/IGNITE-6405 > Project: Ignite > Issue Type: Bug > Affects Versions: 2.1 > Reporter: Alexei Scherbakov > Assignee: Andrey Gura > Priority: Minor > Fix For: 2.5 > > > Timeout exception is thrown instead. > Reproducer: > {noformat} > /* > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with > * this work for additional information regarding copyright ownership. > * The ASF licenses this file to You under the Apache License, Version 2.0 > * (the "License"); you may not use this file except in compliance with > * the License. You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. > */ > package org.apache.ignite.internal.processors.cache.transactions; > import java.util.Collections; > import java.util.concurrent.CountDownLatch; > import javax.cache.CacheException; > import org.apache.ignite.Ignite; > import org.apache.ignite.configuration.CacheConfiguration; > import org.apache.ignite.configuration.IgniteConfiguration; > import org.apache.ignite.configuration.TransactionConfiguration; > import org.apache.ignite.internal.IgniteInternalFuture; > import org.apache.ignite.internal.util.typedef.internal.U; > import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; > import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; > import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; > import org.apache.ignite.transactions.Transaction; > import org.apache.ignite.transactions.TransactionDeadlockException; > import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; > import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; > import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; > /** > * Tests an ability to eagerly rollback timed out transactions. > */ > public class TxPessimisticDeadlockDetectionClient extends GridCommonAbstractTest { > /** */ > private static final long TX_MIN_TIMEOUT = 1; > /** */ > private static final long TX_TIMEOUT = 300; > /** */ > private static final long TX_DEFAULT_TIMEOUT = 3_000; > /** */ > private static final String CACHE_NAME = "test"; > /** IP finder. */ > private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); > /** */ > private static final int GRID_CNT = 3; > /** */ > private final CountDownLatch blocked = new CountDownLatch(1); > /** */ > private final CountDownLatch unblocked = new CountDownLatch(1); > /** {@inheritDoc} */ > @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { > IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); > cfg.setClientMode("client".equals(igniteInstanceName)); > ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); > TransactionConfiguration txCfg = new TransactionConfiguration(); > txCfg.setDefaultTxTimeout(TX_DEFAULT_TIMEOUT); > cfg.setTransactionConfiguration(txCfg); > CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME); > ccfg.setAtomicityMode(TRANSACTIONAL); > ccfg.setBackups(2); > cfg.setCacheConfiguration(ccfg); > return cfg; > } > /** {@inheritDoc} */ > @Override protected void beforeTest() throws Exception { > super.beforeTest(); > startGridsMultiThreaded(GRID_CNT); > } > /** {@inheritDoc} */ > @Override protected void afterTest() throws Exception { > super.afterTest(); > stopAllGrids(); > } > /** */ > protected void validateException(Exception e) { > assertEquals("Deadlock report is expected", > TransactionDeadlockException.class, e.getCause().getCause().getClass()); > } > /** > * Tests if deadlock is resolved on timeout with correct message. > * > * @throws Exception If failed. > */ > public void testDeadlockUnblockedOnTimeout() throws Exception { > Ignite client = startGrid("client"); > testDeadlockUnblockedOnTimeout0(client, ignite(0)); > } > /** > * Tests if deadlock is resolved on timeout with correct message. > * @throws Exception > */ > private void testDeadlockUnblockedOnTimeout0(final Ignite node1, final Ignite node2) throws Exception { > final CountDownLatch l = new CountDownLatch(2); > IgniteInternalFuture fut1 = multithreadedAsync(new Runnable() { > @Override public void run() { > try { > try (Transaction tx = node1.transactions().txStart()) { > node1.cache(CACHE_NAME).put(1, 1); > l.countDown(); > U.awaitQuiet(l); > node1.cache(CACHE_NAME).putAll(Collections.singletonMap(2, 2)); > tx.commit(); > fail(); > } > } catch (CacheException e) { > // No-op. > validateException(e); > } > } > }, 1, "First"); > IgniteInternalFuture fut2 = multithreadedAsync(new Runnable() { > @Override public void run() { > try (Transaction tx = node2.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 0, 2)) { > node2.cache(CACHE_NAME).put(2, 2); > l.countDown(); > U.awaitQuiet(l); > node2.cache(CACHE_NAME).put(1, 1); > tx.commit(); > } > } > }, 1, "Second"); > fut1.get(); > fut2.get(); > assertTrue(node1.cache(CACHE_NAME).containsKey(1)); > assertTrue(node1.cache(CACHE_NAME).containsKey(2)); > } > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)