From issues-return-92758-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Wed Mar 6 10:28:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 5F019180656 for ; Wed, 6 Mar 2019 11:28:04 +0100 (CET) Received: (qmail 24588 invoked by uid 500); 6 Mar 2019 10:28:03 -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 24579 invoked by uid 99); 6 Mar 2019 10:28:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2019 10:28:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 218EF18004C for ; Wed, 6 Mar 2019 10:28:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.5 X-Spam-Level: X-Spam-Status: No, score=-109.5 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id SO5cA1DiWlsu for ; Wed, 6 Mar 2019 10:28:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 5B9E661125 for ; Wed, 6 Mar 2019 10:28:01 +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 B7B19E01AC for ; Wed, 6 Mar 2019 10:28:00 +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 4E3E625748 for ; Wed, 6 Mar 2019 10:28:00 +0000 (UTC) Date: Wed, 6 Mar 2019 10:28:00 +0000 (UTC) From: "Alexey Goncharuk (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (IGNITE-10250) Ignite Queue hangs after several read/write operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/IGNITE-10250?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 785484#comment-16785484 ]=20 Alexey Goncharuk commented on IGNITE-10250: ------------------------------------------- [~xtern], [~sergey-chugunov] thanks, merged to master! > Ignite Queue hangs after several read/write operations > ------------------------------------------------------ > > Key: IGNITE-10250 > URL: https://issues.apache.org/jira/browse/IGNITE-10250 > Project: Ignite > Issue Type: Bug > Components: data structures > Affects Versions: 2.7 > Reporter: Anton Dmitriev > Assignee: Pavel Pereslegin > Priority: Major > Fix For: 2.8 > > > Ignite Queue hangs after several read/write operations. Code to reproduce= : > {code:java} > try (Ignite ignite =3D Ignition.start()) { > IgniteQueue queue =3D ignite.queue("TEST_QUEUE", 1, new Collec= tionConfiguration()); > new Thread(() -> { > for (int i =3D 0;; i++) { > queue.put(i); > System.out.println("Put: " + i); > } > }).start(); > new Thread(() -> { > for (int i =3D 0;; i++) { > queue.take(); > System.out.println("Take: " + i); > } > }).start(); > Thread.currentThread().join(); > } > {code} > *UPDATE AFTER REVIEW* > [~xtern], thank you for investigating this issue, great job! > Unfortunately this hang has a deeper roots and highlights another bug we = have in continuous queries over atomic caches. > Operations of modifying queue header (which results in invoking of CQ lis= tener and subsequent call to onHeaderChange callback)=C2=A0are performed on= a single key (*queueKey*, see *GridAtomicCacheQueueImpl*) so even if they = are called from different threads they should remain serialized. > But in case of atomic cache on single node CQ listeners are called synchr= onously from the same thread that is making operation on the queue=C2=A0and= =C2=A0they are called outside of section where locks on GridCacheMapEntries= objects are held (see method *GridDhtAtomicCache::updateAllAsyncInternal0*= and stack trace below) which breaks guarantee of serialized invocation of = listeners. > So we need to fix this behavior of ATOMIC caches and the issue with queue= s will disappear without any changes in *onHeaderChanged*=C2=A0callback. > Stack trace of the call looks like this: > {code:java} > java.lang.Thread.State: RUNNABLE > =09 at org.apache.ignite.internal.processors.datastructures.GridCacheQue= ueAdapter.onHeaderChanged(GridCacheQueueAdapter.java:517) > =09 at org.apache.ignite.internal.processors.cache.datastructures.CacheD= ataStructuresManager$1.onUpdated(CacheDataStructuresManager.java:305) > =09 at org.apache.ignite.internal.processors.cache.query.continuous.Cach= eContinuousQueryHandler.notifyLocalListener(CacheContinuousQueryHandler.jav= a:946) > =09 at org.apache.ignite.internal.processors.cache.query.continuous.Cach= eContinuousQueryHandler.onEntryUpdate(CacheContinuousQueryHandler.java:877) > =09 at org.apache.ignite.internal.processors.cache.query.continuous.Cach= eContinuousQueryHandler.access$600(CacheContinuousQueryHandler.java:85) > =09 at org.apache.ignite.internal.processors.cache.query.continuous.Cach= eContinuousQueryHandler$2$1.apply(CacheContinuousQueryHandler.java:437) > =09 at org.apache.ignite.internal.processors.cache.query.continuous.Cach= eContinuousQueryHandler$2$1.apply(CacheContinuousQueryHandler.java:432) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicAbstractUpdateFuture.onDone(GridDhtAtomicAbstractUpdateFutur= e.java:560) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicAbstractUpdateFuture.onDone(GridDhtAtomicAbstractUpdateFutur= e.java:62) > =09 at org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(G= ridFutureAdapter.java:452) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicAbstractUpdateFuture.map(GridDhtAtomicAbstractUpdateFuture.j= ava:396) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:1874) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtomicCache.java:1668) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridNearAtomicAbstractUpdateFuture.sendSingleRequest(GridNearAtomicAbstra= ctUpdateFuture.java:299) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridNearAtomicSingleUpdateFuture.map(GridNearAtomicSingleUpdateFuture.jav= a:483) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridNearAtomicSingleUpdateFuture.mapOnTopology(GridNearAtomicSingleUpdate= Future.java:443) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridNearAtomicAbstractUpdateFuture.map(GridNearAtomicAbstractUpdateFuture= .java:248) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicCache.update0(GridDhtAtomicCache.java:1150) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicCache.invoke0(GridDhtAtomicCache.java:831) > =09 at org.apache.ignite.internal.processors.cache.distributed.dht.atomi= c.GridDhtAtomicCache.invoke(GridDhtAtomicCache.java:787) > =09 at org.apache.ignite.internal.processors.datastructures.GridAtomicCa= cheQueueImpl.transformHeader(GridAtomicCacheQueueImpl.java:170) > =09 at org.apache.ignite.internal.processors.datastructures.GridAtomicCa= cheQueueImpl.offer(GridAtomicCacheQueueImpl.java:53) > =09 at org.apache.ignite.internal.processors.datastructures.GridCacheQue= ueAdapter.put(GridCacheQueueAdapter.java:252) > =09 at org.apache.ignite.internal.processors.datastructures.GridCacheQue= ueProxy.put(GridCacheQueueProxy.java:359) > =09 at org.apache.ignite.internal.processors.cache.datastructures.GridCa= cheQueueApiSelfAbstractTest.lambda$checkPutAndGetInDifferentThreadsMultithr= eaded$0(GridCacheQueueApiSelfAbstractTest.java:456) > =09 at org.apache.ignite.internal.processors.cache.datastructures.GridCa= cheQueueApiSelfAbstractTest$$Lambda$85.291482897.run(Unknown Source:-1) > =09 at org.apache.ignite.testframework.GridTestUtils$7.call(GridTestUtil= s.java:1300) > =09 at org.apache.ignite.testframework.GridTestThread.run(GridTestThread= .java:84) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)