From dev-return-10067-archive-asf-public=cust-asf.ponee.io@curator.apache.org Tue Feb 19 13:23:20 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 9C0A818060E for ; Tue, 19 Feb 2019 14:23:19 +0100 (CET) Received: (qmail 77729 invoked by uid 500); 19 Feb 2019 13:23:18 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 77711 invoked by uid 99); 19 Feb 2019 13:23:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2019 13:23:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id AD156C980D for ; Tue, 19 Feb 2019 13:23:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.624 X-Spam-Level: * X-Spam-Status: No, score=1.624 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SUBJ_ALL_CAPS=1.625] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=jordanzimmerman-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 1wULlDr4W_dc for ; Tue, 19 Feb 2019 13:23:16 +0000 (UTC) Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 2856C6138E for ; Tue, 19 Feb 2019 13:23:16 +0000 (UTC) Received: by mail-ua1-f50.google.com with SMTP id v26so6937032uap.4 for ; Tue, 19 Feb 2019 05:23:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jordanzimmerman-com.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=fEsISOmaG3K92tKq4lMfJQpen4BGAj4mrXQkGgjL188=; b=cR69+ga0xPhms5fgFYG/oVDFzr3+g2/8ieZrxq9knvH1AB0nRowq7feD7MihEtk0BF r8c5wdr7bQOOB/cRWdwOjtFFSY4gWa9NEWH2EMfbNwWE1D15i9IE2Xj/NvMxWxHYpDci hbbRlGXATyMF9EshKmM7pujy/1CGI8bq25uP0LS0TyE8OTwtvDmPo2ApDNEIg2ZeAvb1 wUhZLLHfJoWFtwYDq4S+ntwPmRLcp4ug7ytChQ2F5Cu0sD6QeQVStvxws9quIXi7IIEr k7okAo4BBRULMvueUhBBQ5IuU/SsgtMYKx3LfQ49W++oHL6s412vocaDhA2ne1qqWNrE 8EZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=fEsISOmaG3K92tKq4lMfJQpen4BGAj4mrXQkGgjL188=; b=CdNGohzHP2cOVRQbukr7HPDdl2CQANTiGTmkB09lHKyVsAiH5OOCr/kTq4/zJ+hojV l3kuV4q46JGEW10VMxm9cDF2XdmW+5ssaNzrBd1E9VBbDCaCNksq23pRnsDV3AlBhQ1l ViKNeCV08SQ4z26hgvvQnBlXo0uJ9GQkELXS3krzTFWVLBOirFC7KQUNB0WxpcmW0OP2 eXhcWcVSQFEjH1Y9oF3QzuYlw5puvUlfPdzgQuVVm6tnl1S2pWWdwFmo6jFePjVdPUxY ih2daDtAb+y06iBIdJaq0WkzDzByfQ+3jvHpk6zwbRHS0QqT5rfv2T8rclvmIGBU3N/s nzVg== X-Gm-Message-State: AHQUAubhNTGb0xgic9PyV+th8DdweReSW/Gm1bKvSflQPFCj7hzaZxjE e9OLCCpZkT05t7TXGIXS6NjbmJn9dcJqvQ== X-Google-Smtp-Source: AHgI3IbE+VRb7g1icaQtKQgw7laeloTFtL9IbA6LjIxrwi0uoFQfohywFS3t4Gt/tRdmqba4xdSxKQ== X-Received: by 2002:ab0:6299:: with SMTP id z25mr3650530uao.69.1550582595300; Tue, 19 Feb 2019 05:23:15 -0800 (PST) Received: from [10.0.1.83] ([186.72.212.38]) by smtp.gmail.com with ESMTPSA id g195sm6201491vka.5.2019.02.19.05.23.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 05:23:14 -0800 (PST) From: Jordan Zimmerman Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: POSIBLE ISSUE WITH PERSISTENT NODE Date: Tue, 19 Feb 2019 08:23:13 -0500 References: <1845306935.2683931.1550582285735.ref@mail.yahoo.com> <1845306935.2683931.1550582285735@mail.yahoo.com> To: dev@curator.apache.org In-Reply-To: <1845306935.2683931.1550582285735@mail.yahoo.com> Message-Id: <0156FE30-626B-4142-B51C-72485EDCDBDA@jordanzimmerman.com> X-Mailer: Apple Mail (2.3445.9.1) The formatting got badly corrupted in this email. Maybe you can resend? = Or, open an issue in our Jira. -JZ > On Feb 19, 2019, at 8:18 AM, Evaristo Jos=C3=A9 Camarero = wrote: >=20 > Hi there, > I am using Apache Curator 4.1.0 with Zk 3.4.10 (Open JDK 1.8) > openjdk version "1.8.0_191" >=20 >=20 > I am PersistentNode recipe and I am receiving this exception >=20 >=20 > java.lang.IllegalStateException: initial create has not been = processed. Call waitForInitialCreate() to ensure. at = org.apache.curator.shaded.com.google.common.base.Preconditions.checkState(= Preconditions.java:444) at = org.apache.curator.framework.recipes.nodes.PersistentNode.setData(Persiste= ntNode.java:392) at = com.cheva.udr.sm.RemoteReporter.reportToRemote(RemoteReporter.java:67) = at com.cheva.udr.sm.RemoteReporter.lambda$2(RemoteReporter.java:84) = at = java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) = at java.util.concurrent.FutureTask.run(FutureTask.java:266) = at = java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:= 1149) at = java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java= :624) at java.lang.Thread.run(Thread.java:748) >=20 >=20 > My class RemoteReporter.java (assumes that PersistentNode is thread = safe) > // The class is final, and the attribute is private final so allow = safe publicationprivate final Persistent pn; >=20 > Constrcutor() {...PersistentNode pn =3D new PersistentNode(cf, = CreateMode.EPHEMERAL, false, path, dataToReport()); > } > // Class has also an start methodstart() {...79 = pn.start();...// Create new thread and execute the follwoing code84 = pn.waitForInitialCreate(1000, TimeUnit.DAYS);85 = pn.setData("XXx");86 = statusCache.getListenable().addListener(listener);} >=20 > I was checking the PersistentNode code and the excepction happens = because nodePath.get()=3D=3Dnull variable. I am not 100% sure if the = problem is in my code or in the recipe... > - My code is using the waitForinitial as suggested- The recipe uses a = CountDownLatch, but there are 2 different paths for the latch to be = countDown (via initalisationComplete() method), and I am not sure that = one of them assures that nodePath.get() !=3D null >=20 > In this code snippet, you can see that the latch is countDown, but I = am not sure that nodePath.set(whatever) is called, so I guess there = could be a race condition > private final BackgroundCallback setDataCallback =3D new = BackgroundCallback() { > @Override public void processResult(CuratorFramework = dummy, CuratorEvent event) throws Exception { = //If the result is ok then initialisation is complete (if we're still = initialising) //Don't retry on other errors as the only = recoverable cases will be connection loss //and the node not = existing, both of which are already handled by other watches. = if ( event.getResultCode() =3D=3D KeeperException.Code.OK.intValue() ) = { //Update is ok, mark initialisation as = complete if required. initialisationComplete(); = } else if ( event.getResultCode() =3D=3D = KeeperException.Code.NOAUTH.intValue() ) { = log.warn("Client does not have authorisation to write node at path {}", = event.getPath()); authFailure.set(true); } = } }; > Thanks in adavance for the help, > Evaristo