From dev-return-68563-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu Mar 29 16:59:05 2018 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 30839180645 for ; Thu, 29 Mar 2018 16:59:05 +0200 (CEST) Received: (qmail 28661 invoked by uid 500); 29 Mar 2018 14:59:03 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 28650 invoked by uid 99); 29 Mar 2018 14:59:03 -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, 29 Mar 2018 14:59:03 +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 3753C1A16E6 for ; Thu, 29 Mar 2018 14:59:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id D9yD2d-3CNGN for ; Thu, 29 Mar 2018 14:59:02 +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 464FB5F5F8 for ; Thu, 29 Mar 2018 14:59:02 +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 8DBCAE0EB9 for ; Thu, 29 Mar 2018 14:59:01 +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 54CD0255F4 for ; Thu, 29 Mar 2018 14:59:01 +0000 (UTC) Date: Thu, 29 Mar 2018 14:59:01 +0000 (UTC) From: "Andor Molnar (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-3014) watch can be added to non-existed path by exist command 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/ZOOKEEPER-3014?page=3Dcom.atlas= sian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D= 16419135#comment-16419135 ]=20 Andor Molnar commented on ZOOKEEPER-3014: ----------------------------------------- I've attached the console app that I was testing with. > watch can be added to non-existed path by exist command > ------------------------------------------------------- > > Key: ZOOKEEPER-3014 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3014 > Project: ZooKeeper > Issue Type: Bug > Components: server > Affects Versions: 3.4.5, 3.4.6 > Reporter: CHQ > Priority: Major > Fix For: 3.4.12 > > Attachments: TestCurator.java, image-2018-03-28-22-51-33-751.png > > > We have client A which create a znode ,and its path is /zk/lock/100000.= =C2=A0 Another client B thread is acquiring for the lock, so it calls the e= xist command with watch=C2=A0periodically to check if it is available. Then= Client A has finished this work, and=C2=A0 delete this znode. Client b sti= ll calls exist command with watch. Because=C2=A0the code doesn't check node= existence, when the=C2=A0 Watch add operation comes , it will add to non-e= xist node path. > This problem may=C2=A0be cause=C2=A0by the follow code.=C2=A0 > {code:java} > public Stat statNode(String path, Watcher watcher) > throws KeeperException.NoNodeException { > Stat stat =3D new Stat(); > DataNode n =3D nodes.get(path); > if (watcher !=3D null) { > dataWatches.addWatch(path, watcher); > } > if (n =3D=3D null) { > throw new KeeperException.NoNodeException(); > } > synchronized (n) { > n.copyStat(stat); > return stat; > } > } > {code} > The zk version we use is 3.4.5. We meet a problem that is the zk client t= ry to=C2=A0reestablish=C2=A0to zk cluster failed after disconnect for some = reason.We find it causes by ZOOKEEPER-706. But we try to know why there are= so many watches. Then we find this problem. > =C2=A0 > =C2=A0 > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)