Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35E8A10B0C for ; Thu, 27 Mar 2014 17:31:20 +0000 (UTC) Received: (qmail 31401 invoked by uid 500); 27 Mar 2014 17:31:17 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 31359 invoked by uid 500); 27 Mar 2014 17:31:16 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 31329 invoked by uid 99); 27 Mar 2014 17:31:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 17:31:15 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.214.170] (HELO mail-ob0-f170.google.com) (209.85.214.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 17:31:10 +0000 Received: by mail-ob0-f170.google.com with SMTP id uz6so4701685obc.29 for ; Thu, 27 Mar 2014 10:30:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:message-id:in-reply-to:references :subject:mime-version:content-type; bh=1CQtrFY7xrSS2Qn70O5bdA3pKWF7TDlrJwXOW1NGLEE=; b=AvFpAi2rF8XxMmhywXzFAqhGSbqXlHhLqd/4GjDhNgRuSieV7ssJTzgGUuwLDz1eCX 4UAgDRi973jcb4ZvsisUaZQMXOiEGE7fwqZPxa11tC3vsACgcwV3ylsVOLlmzmFUZ68D 8g79HzNKqzPkG34HiUapphBPW4/kahMEWL7Icqm5cHGhT5iIuK8AT5OBq9wajkA0uVDo AItBkDhgQMutYO4irpYStNRCFqBbAH6GybikglxLDMgraLYAddMOJs/xQCLN097I88nf WO44VI05OauLsdEat5gbWd+Pj1FFMyNCKOgUfvrjoB29VObjdowYHuaokZcnx/DhgqZq lPlw== X-Gm-Message-State: ALoCoQnvsiXgL1/N4DG7uQF46z+2h1l5kKjvEheeEFZoaMPc74adKQK9ivlH1bmexiaCZOdTUVJh X-Received: by 10.182.33.6 with SMTP id n6mr2497187obi.48.1395941448960; Thu, 27 Mar 2014 10:30:48 -0700 (PDT) Received: from Jordans-MacBook-Pro.local (cpe-907240009601.cpe.cableonda.net. [190.219.168.142]) by mx.google.com with ESMTPSA id m7sm4338397obo.7.2014.03.27.10.30.46 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 10:30:48 -0700 (PDT) Date: Thu, 27 Mar 2014 12:30:26 -0500 From: Jordan Zimmerman To: Brian Phillips , user@curator.apache.org Message-ID: In-Reply-To: <20140327172552.e827b205@mail02.etinternational.com> References: <20140327172552.e827b205@mail02.etinternational.com> Subject: Re: Curator barriers missing watch events X-Mailer: Airmail (231) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="53346042_15b5af5c_14f7" X-Virus-Checked: Checked by ClamAV on apache.org --53346042_15b5af5c_14f7 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline https://cwiki.apache.org/confluence/display/CURATOR/TN1 :) =46rom:=C2=A0Brian Phillips brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org user=40curator.apache.org Date:=C2=A0March 27, 2014 at 12:26:32 PM To:=C2=A0user=40curator.apache.org user=40curator.apache.org Subject:=C2=A0 Re: Curator barriers missing watch events =20 I finally figured out my problem, and it was my fault. Hopefully someone = else can learn from this. What was happening was that I was using a zookeeper watch event to kick o= ff a bunch of code, which then ended up in the zookeeper/curator barrier.= Since the watch thread was the one that executed the barrier, it blocked= itself from receiving any additional watch events from zookeeper, includ= ing the ones that the barrier depended upon. So as a general rule, DON'T BLOCK YOUR WATCH THREADS. I feel stupid for n= ot realizing this sooner. =5FBrian=3D =46rom: Brian Phillips =5Bmailto:brian=40etinternational.com=5D To: user=40curator.apache.org Sent: Wed, 26 Mar 2014 15:32:13 -0500 Subject: Re: Curator barriers missing watch events So I'm still working on this issue. I grabbed a zookeeper only barrier im= plementation from here: http://zookeeper.apache.org/doc/r3.3.3/zookeeperTutorial.html This barrier makes it's own zookeeper connection=C2=A0separately=C2=A0fro= m the curator connection that my program uses. When I put this barrier in= to my program, everything works as it should, and nobody gets stuck on th= e barriers. I then modified the barrier to use curators connection, passi= ng in=C2=A0Curator=46ramework.getZookeeperClient().getZooKeeper() instead= of connecting separately. Once I did this, it breaks exactly as it did b= efore when using the curator barrier. This seems to indicate to me that something else I've done in the program= has 'broken' the zookeeper session associated with my curator connection= , to the point where some watch events no longer work. I'm going to embark on the arduous process of trying to figure out what I= 'm doing thats breaking my sessions watches. Watches not working properly= is disturbing, and will certainly prevent other parts of my program from= functioning correctly, probably in less obvious ways. =5FBrian=3D =46rom: Brian Phillips =5Bmailto:brian=40etinternational.com=5D To: user=40curator.apache.org =5Bmailto:user=40curator.apache.org=5D Sent: Tue, 25 Mar 2014 20:39:31 -0500 Subject: Re: Curator barriers missing watch events Yes, there's two barrier sessions. But different barrier instances, and d= ifferent barrier paths. ): Sent from my iPhone On Mar 25, 2014, at 8:34 PM, =22Jordan Zimmerman=22 wrote: Are you saying there are two barrier sessions=3F The first one works, but= the second doesn=E2=80=99t=3F Are you re-using the same path=3F I wonder= if there are znodes left in the path or something. Before running the se= cond barrier session, double check that the path is empty (do a getChildr= en on it). If it=E2=80=99s not empty that could be the problem. -JZ =46rom:=C2=A0Brian Phillips brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org user=40curator.apache.org Date:=C2=A0March 25, 2014 at 6:10:46 PM To:=C2=A0user=40curator.apache.org user=40curator.apache.org Subject:=C2=A0 Re: Curator barriers missing watch events I=E2=80=99ve tried, but it seems to be timing specific. Its in a rather l= arge complicated program, where the first barrier always works but the on= e at the end of the program usually gets stuck. I=E2=80=99ve spent all da= y trying to make sense of it, as my project really needs it to work. I=E2=80=99d like to be able to figure out if the zookeeper server is actu= ally sending my clients the watch events.=C2=A0 =5FB On Mar 25, 2014, at 6:53 PM, =22Jordan Zimmerman=22 wrote: There=E2=80=99s no way you can distill your usage into a test=3F -JZ =46rom:=C2=A0Brian Phillips brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org user=40curator.apache.org Date:=C2=A0March 25, 2014 at 5:51:37 PM To:=C2=A0user=40curator.apache.org user=40curator.apache.org Subject:=C2=A0 Re: Curator barriers missing watch events Hmm, I made that change, but it didn't seem to help. The first program ma= de it to the barrier enter, then the second program entered, exited, and = the first program never left the barrier. The second program got a node created event, but the first program never = got any event from its watcher. I appreciate the help=21 Must be something else. =5FB On Mar 25, 2014, at 6:28 PM, =22Jordan Zimmerman=22 wrote: Look at line 313 and line 331. The noarg version of enter() causes=C2=A0i= nternalEnter() to call wait even though the watcher may have already noti= fied. I believe line 331 should be: else=C2=A0if ( =21hasBeenNotified.get() ) -JZ =46rom:=C2=A0Brian Phillips brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org user=40curator.apache.org Date:=C2=A0March 25, 2014 at 5:25:48 PM To:=C2=A0user=40curator.apache.org user=40curator.apache.org Subject:=C2=A0 Re: Curator barriers missing watch events I am using the no arg version=21 What's the bug=3F =5FB On Mar 25, 2014, at 6:23 PM, =22Jordan Zimmerman=22 wrote: Which version of enter() are you using=3F I see a potential bug when the = no arg version of enter() is used. =46rom:=C2=A0Brian Phillips brian=40etinternational.com Reply:=C2=A0Brian Phillips brian=40etinternational.com Date:=C2=A0March 25, 2014 at 4:19:36 PM To:=C2=A0Jordan Zimmerman jordan=40jordanzimmerman.com Subject:=C2=A0 Re: Curator barriers missing watch events Good idea, but yes I am. The connection state doesn=E2=80=99t change whil= e I=E2=80=99m executing the barrier code. It seems to be some kind of rac= e condition I think, as sometimes it work and sometimes it doesn=E2=80=99= t. I=E2=80=99ve looked through the recipe code and it looks good as far a= s I can tell though. I=E2=80=99m practically pulling my hair out at this = point. I may try a non-curator zookeeper only barrier tomorrow. See if that work= s. Or I may start trying to debug the zookeeper client, see if its actual= ly getting the watches but not delivering them. =5FB On Mar 25, 2014, at 4:54 PM, Jordan Zimmerman wrote: Are you setting a ConnectionStateListener=3F If the connection gets SUSPE= NDED or LOST then you=E2=80=99d need to reinitialize your barrier. -JZ =46rom:=C2=A0Brian Phillips=C2=A0brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org=C2=A0user=40curator.apache.org Date:=C2=A0March 25, 2014 at 2:51:42 PM To:=C2=A0user=40curator.apache.org=C2=A0user=40curator.apache.org Subject:=C2=A0=C2=A0Re: Curator barriers missing watch events=C2=A0 I have tried writing a test program which launches two programs in the sa= me manor, each makes a connection then loops over barriers with a Thread.= sleep(random) in-between. This run indefinitely and everything works out = fine. I have also tried writing my own barrier, which uses a SharedCount, where= each guy tries to increment it until it hits a memberQty. This too misse= d watch events and does not work properly. It=E2=80=99s almost as if something else that I=E2=80=99ve done during th= e running of my program has broken zookeepers watch events somehow. Is th= ere any good way to debug watch events in general=3F I=E2=80=99ve tried t= o look at the DEBUG output for my zookeeper server log, but it looks the = same for the working vs non-working barriers... =5FB On Mar 25, 2014, at 3:42 PM, Jordan Zimmerman wrote: Unfortunately, the barrier recipes aren=E2=80=99t widely used (from what = I know). So, there may well be a bug. If you could get a test to show the= problem that would be ideal. -JZ =46rom:=C2=A0Brian Phillips=C2=A0brian=40etinternational.com Reply:=C2=A0user=40curator.apache.org=C2=A0user=40curator.apache.org Date:=C2=A0March 25, 2014 at 2:38:40 PM To:=C2=A0user=40curator.apache.org=C2=A0user=40curator.apache.org Subject:=C2=A0=C2=A0Curator barriers missing watch events=C2=A0 Hi guys,=C2=A0 I=E2=80=99ve been integrating curator into my project and have recently r= un into an issue I just can=E2=80=99t seem to make sense of.=C2=A0 I=E2=80=99m running two JVMs on the same host machine, each with their ow= n curator connection. At the beginning of my program I=E2=80=99m using th= e DistributedDoubleBarrier recipe, and once again at the end of my progra= m. A bunch of work is done in-between, including zookeeper set/get/watche= s of other nodes.=C2=A0 I=E2=80=99m finding that the first double barrier, everyone always making= it through. The job-end barrier, sometimes everyone gets through, but mo= re often than not one of the programs hangs in enter's wait(), and never = gets the watch event for the ready path which notifies it to proceed. If = I look in zookeeper, I can see that the ready path is actually set in the= re.=C2=A0 It would seem that the watch for one of the programs just never triggers.= =C2=A0 To simplify debugging, I=E2=80=99ve set both double barriers to only ever= call enter() and not leave(). Both barriers have their own separate path= .=C2=A0 Also, the program never shuts down or disconnects from zookeeper. It just= sleeps infinitely after it gets out of the final barrier.=C2=A0 Any idea on how to debug this issue=3F I don=E2=80=99t mind hacking up zo= okeeper/curator code to insert my own debugging statements if it comes to= that.=C2=A0 =5FBrian=3D --53346042_15b5af5c_14f7 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline