Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0505C10D7C for ; Mon, 5 Aug 2013 12:01:16 +0000 (UTC) Received: (qmail 83783 invoked by uid 500); 5 Aug 2013 12:01:15 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 83722 invoked by uid 500); 5 Aug 2013 12:01:12 -0000 Mailing-List: contact dev-help@curator.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.incubator.apache.org Delivered-To: mailing list dev@curator.incubator.apache.org Received: (qmail 83714 invoked by uid 99); 5 Aug 2013 12:01:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Aug 2013 12:01:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 05 Aug 2013 12:01:09 +0000 Received: (qmail 83409 invoked by uid 99); 5 Aug 2013 12:00:49 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Aug 2013 12:00:49 +0000 Date: Mon, 5 Aug 2013 12:00:49 +0000 (UTC) From: "Michael Morello (JIRA)" To: dev@curator.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CURATOR-3) LeaderLatch race condition causing extra nodes to be added in Zookeeper Edit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CURATOR-3?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13729437#comment-13729437 ] Michael Morello commented on CURATOR-3: --------------------------------------- What version are you using ? It seems to me that CURATOR-3 is a duplicate of CURATOR-18, if it is the case it must be fixed since 2.0.1-incubating Could you try to reproduce with Curator 2.1.0-incubating ? > LeaderLatch race condition causing extra nodes to be added in Zookeeper Edit > ---------------------------------------------------------------------------- > > Key: CURATOR-3 > URL: https://issues.apache.org/jira/browse/CURATOR-3 > Project: Apache Curator > Issue Type: Bug > Components: Recipes > Affects Versions: 2.0.0-incubating > Reporter: Jordan Zimmerman > > From https://github.com/Netflix/curator/issues/265 > Looks like there's a race condition in LeaderLatch. If LeaderLatch.close() is called at the right time while the latch's watch handler is running, the latch will place another node in Zookeeper after the latch is closed. > Basically how it happens is this: > 1) I have two processes contesting a LeaderLatch, ProcessA and ProcessB. ProcessA is leader. > 2) ProcessA loses leadership somehow (it releases, its connection goes down, etc.) > 3) This causes ProcessB's watch to get called, check the state is still STARTED, and if so the LeaderLatch will re-evaluate if it is leader. > 4) While the watch handler is running, close() is called on the LeaderLatch on ProcessB. This sets the LeaderLatch state to CLOSED, removes the znode from ZK and closes off the LeaderLatch. > 5) The watch handler has already checked that the state is STARTED, so it does a getChildren() on the latch path, and finds the latch's znode is missing. It goes ahead and calls reset(), which places a new znode in Zookeeper. > Result: The LeaderLatch is closed, but there is still a node in Zookeeper that isn't associated with any LeaderLatch and won't go away until the session goes down. Subsequent LeaderLatches at this path can never get leadership while that session is up. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira