curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-310) Race in PersistentNode startup
Date Tue, 29 Mar 2016 01:35:25 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15215221#comment-15215221
] 

ASF GitHub Bot commented on CURATOR-310:
----------------------------------------

GitHub user Randgalt opened a pull request:

    https://github.com/apache/curator/pull/140

    [CURATOR-310] Race in PersistentNode startup

    This is a semi-punt but a reasonable one. The simple solution is for the client to call
waitForInitialCreate() before calling setData(). So, now, setData() throws an exception if
the initial create has not occurred.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/curator CURATOR-310

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/curator/pull/140.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #140
    
----
commit f4dcec3e6f80616f76f428c25787ff3293273a5a
Author: randgalt <randgalt@apache.org>
Date:   2016-03-29T01:32:55Z

    Check for initial create in setData()

----


> Race in PersistentNode startup
> ------------------------------
>
>                 Key: CURATOR-310
>                 URL: https://issues.apache.org/jira/browse/CURATOR-310
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.10.0
>            Reporter: Gerd Behrmann
>
> We ran into what looks like a race in PersisentNode startup:
> java.lang.IllegalArgumentException: Path cannot be null
>         at org.apache.curator.utils.PathUtils.validatePath(PathUtils.java:48) ~[curator-client-2.10.0.jar:na]
>         at org.apache.curator.utils.PathUtils.validatePath(PathUtils.java:37) ~[curator-client-2.10.0.jar:na]
>         at org.apache.curator.utils.ZKPaths.fixForNamespace(ZKPaths.java:105) ~[curator-client-2.10.0.jar:na]
>         at org.apache.curator.framework.imps.NamespaceImpl.fixForNamespace(NamespaceImpl.java:104)
~[curator-framework-2.10.0.jar:na]
>         at org.apache.curator.framework.imps.CuratorFrameworkImpl.fixForNamespace(CuratorFrameworkImpl.java:594)
~[curator-framework-2.10.0.jar:na]
>         at org.apache.curator.framework.imps.SetDataBuilderImpl.forPath(SetDataBuilderImpl.java:244)
~[curator-framework-2.10.0.jar:na]
>         at org.apache.curator.framework.imps.SetDataBuilderImpl.forPath(SetDataBuilderImpl.java:41)
~[curator-framework-2.10.0.jar:na]
>         at dmg.cells.zookeeper.CellCuratorFramework$PathAndBytesableDecorator.forPath(CellCuratorFramework.java:1369)
~[cells-2.16.0-SNAPSHOT.jar:2.16.0-SNAPSHOT]
>         at org.apache.curator.framework.recipes.nodes.PersistentNode.setData(PersistentNode.java:323)
~[curator-recipes-2.10.0.jar:na]
> The problem here is that PersistentNode#setData calls PersistentNode#getActualPath, however
the nodePath field accessed by PersistentNode#getActualPath isn't set until PersistentNode#processBackgroundCallback
is called as a result of the createNode call in PersistentNode#start. 
> I.e. if one calls PersistentNode#setData right after calling start, there is a race between
the node creation initializing the actual path and PersistentNode#setData accessing it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message