curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Luecke (JIRA)" <>
Subject [jira] [Created] (CURATOR-179) Sequential path creation of /somepath/N throws exception
Date Wed, 07 Jan 2015 00:34:34 GMT
Ryan Luecke created CURATOR-179:

             Summary: Sequential path creation of /somepath/N throws exception
                 Key: CURATOR-179
             Project: Apache Curator
          Issue Type: Bug
          Components: Framework
    Affects Versions: 2.7.0
            Reporter: Ryan Luecke

A new error is thrown when attempting to run one of our scala services with Curator 2.7.0.
The error does not throw in 2.6.0 (or in 2.5.0, which is when the original code was written.
We were updating to 2.7.0).

Stack trace:
[error] Exception in thread "main" java.lang.IllegalArgumentException: Path must not end with
/ character
[error] 	at org.apache.curator.utils.PathUtils.validatePath(
[error] 	at org.apache.curator.utils.ZKPaths.fixForNamespace(
[error] 	at org.apache.curator.framework.imps.NamespaceImpl.fixForNamespace(
[error] 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.fixForNamespace(
[error] 	at org.apache.curator.framework.imps.CreateBuilderImpl$1.forPath(
[error] 	at org.apache.curator.framework.imps.CreateBuilderImpl$1.forPath(
[error] 	at<application code>.scala:175)

This happens when we try to create node /somepath/N (where N is sequential zk node).

In Curator, PathUtils.validatePath has two signatures:
1. public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException
     validatePath(isSequential? path + "1": path);
2. public static String validatePath(String path) throws IllegalArgumentException {
  throws if path ends in '/'

In our case, path /somepath/ does end in '/'

The way #1 calls #2 appears to be a hack (appending "1" to path in order to validate). This
would have caused path validation to *succeed* for our case - however, the caller MUST call
this #1 signature of validatePath. The code calls actually calls #2 instead.

2.5.0 released May 28, 2014
2.6.0 released July 11, 2014
* issue introduced
2.7.0 released November 3, 2014

I believe the issue was introduced on July 29 2014, when a call to #2 above was added to fixForNamespace(String
namespace, String path) in

We've decided to workaround the issue at the moment. Our workaround is straightforward:
Change our sequential node path from /somepath/N
to /somepath/entry_N

Please get in touch if you need additional information to solve this issue. Thanks!

This message was sent by Atlassian JIRA

View raw message