curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CURATOR-345) NPE in EnsembleTracker when starting Curator
Date Wed, 28 Sep 2016 10:13:20 GMT


ASF GitHub Bot commented on CURATOR-345:

GitHub user Randgalt opened a pull request:

    [CURATOR-345] clientAddr might be null in which case addr should be used.


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

    $ git pull CURATOR-345

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

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

    This closes #166
commit 1998491612c2b2658d776b6a71de41ac3d20e0f2
Author: randgalt <>
Date:   2016-09-28T10:10:38Z

    clientAddr might be null in which case addr should be used.


> NPE in EnsembleTracker when starting Curator
> --------------------------------------------
>                 Key: CURATOR-345
>                 URL:
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 3.1.0, 3.2.0
>         Environment: ZooKeeper 3.5.1-alpha
>            Reporter: Alex Rankin
>            Assignee: Jordan Zimmerman
>            Priority: Minor
> We're currently getting a NPE when running Curator 3.1.0 and 3.2.0 in our environment.
I don't believe this was occurring before we upgraded to ZooKeeper 3.5.1-alpha and Curator
> {code}
>  java.lang.NullPointerException
>  	at org.apache.curator.framework.imps.EnsembleTracker.configToConnectionString(
> 	at org.apache.curator.framework.imps.EnsembleTracker.processConfigData(
> 	at org.apache.curator.framework.imps.EnsembleTracker.access$300(
> 	at org.apache.curator.framework.imps.EnsembleTracker$2.processResult(
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(
> 	at org.apache.curator.framework.imps.WatcherRemovalFacade.processBackgroundOperation(
> 	at org.apache.curator.framework.imps.GetConfigBuilderImpl$2.processResult(
> 	at org.apache.zookeeper.ClientCnxn$EventThread.processEvent( [zookeeper-3.5.1-alpha.jar:?]
> 	at org.apache.zookeeper.ClientCnxn$ [zookeeper-3.5.1-alpha.jar:?]
> {code}
> The problem is that the QuorumServer.clientAddr here is null. This seems to be filled
by parsing the ZooKeeper server properties, which look something like:
> {quote}
> server.1=zoo1:2888:3888
> server.2=zoo2:2888:3888
> server.3=zoo3:2888:3888
> {quote}
> In the QuorumServer constructor, we parse each server line into its respective tasks.
The clientAddr, however, is filled by splitting the line around a semicolon and taking the
second part:
> {code}
> String[] serverClientParts = addressStr.split(";");
> ...
> if(serverClientParts.length == 2) {
>     String[] e = splitWithLeadingHostname(serverClientParts[1]);
>     if(e.length > 2) {
>         throw new ConfigException(addressStr + " does not have the form server_config
or server_config;client_config where server_config is host:port:port or host:port:port:type
and client_config is port or host:port");
>     }
>     String hostname = e.length == 2?e[0]:"";
>     ...
> }
> {code}
> This suggests that the server string should be followed by a client host/port (or just
port), e.g.:
> {quote}
> server.1=zoo1:2888:3888;2181
> server.2=zoo2:2888:3888;2181
> server.3=zoo3:2888:3888;localhost:2181
> {quote}
> I can't find anything in the ZooKeeper documentation about this though, and it isn't
mandatory in the properties (so shouldn't throw a NPE).
> This occurs every time we start the server, but doesn't affect functionality, hence the
Minor flag. It would be nice to know what exactly is expected here though, so we can get rid
of the exception.

This message was sent by Atlassian JIRA

View raw message