curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <>
Date Tue, 19 Feb 2019 13:23:13 GMT
The formatting got badly corrupted in this email. Maybe you can resend? Or, open an issue in
our Jira.


> On Feb 19, 2019, at 8:18 AM, Evaristo José Camarero <>
> 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"
> I am PersistentNode recipe and I am receiving this exception
> java.lang.IllegalStateException: initial create has not been processed. Call waitForInitialCreate()
to ensure.        at
       at        at$2(        at java.util.concurrent.Executors$
       at        at java.util.concurrent.ThreadPoolExecutor.runWorker(
       at java.util.concurrent.ThreadPoolExecutor$
> My class (assumes that PersistentNode is thread safe)
> // The class is final, and the attribute is private final so allow safe publicationprivate
final Persistent pn;
> Constrcutor() {...PersistentNode pn = 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);}
> I was checking the PersistentNode code and the excepction happens because nodePath.get()==null
 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() != null
> 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 = 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() == KeeperException.Code.OK.intValue()
)            {                //Update is ok, mark initialisation as complete if required.
               initialisationComplete();            }            else if ( event.getResultCode()
== 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

View raw message