[ https://issues.apache.org/jira/browse/ZOOKEEPER-2681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Egor Ryashin resolved ZOOKEEPER-2681. ------------------------------------- Resolution: Invalid It is actually a Curator Framework issue. https://issues.apache.org/jira/browse/CURATOR-382 > ConnectionState does not sync startup of ExhibitorEnsembleProvider and > Zookeeper connection > ------------------------------------------------------------------------------------------- > > Key: ZOOKEEPER-2681 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2681 > Project: ZooKeeper > Issue Type: Bug > Components: java client > Affects Versions: 3.4.5 > Reporter: Egor Ryashin > > Use CuratorFrameworkFactory.Builder and specify ExhibitorEnsembleProvider. > Call build() and start(). > Internal ConnectionState.start() calls ensembleProvider.start() which should > poll for hostnames to produce connectionString. > Without waiting (for connectionString) ConnectionState calls > zooKeeper.closeAndReset() and ClientCnxn is created with empty > connectionString. That leads to lame zooKeeper sending requests to localhost. > {noformat} > 2017-01-27T22:56:17,618 INFO [Agents-0] > org.apache.curator.framework.imps.CuratorFrameworkImpl - Starting > 2017-01-27T22:56:17,619 INFO [Agents-0] org.apache.zookeeper.ZooKeeper - > Initiating client connection, connectString= sessionTimeout=60001 > watcher=org.apache.curator.ConnectionState@4402fad2 > 2017-01-27T22:56:17,625 INFO [Agents-0-SendThread(127.0.0.1:2181)] > org.apache.zookeeper.ClientCnxn - Opening socket connection to server > 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL > (unknown error) > 2017-01-27T22:56:18,632 WARN [Agents-0-SendThread(127.0.0.1:2181)] > org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected > error, closing socket connection and attempting reconnect > java.net.ConnectException: Connection refused: no further information > at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) > ~[?:1.8.0_74] > at > sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) > ~[?:1.8.0_74] > at > org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) > ~[zookeeper-3.4.5.jar:3.4.5-1392090] > at > org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) > [zookeeper-3.4.5.jar:3.4.5-1392090] > 2017-01-27T22:56:19,733 INFO [Agents-0-SendThread(127.0.0.1:2181)] > org.apache.zookeeper.ClientCnxn - Opening socket connection to server > 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL > (unknown error) > 2017-01-27T22:56:19,807 INFO [Curator-ExhibitorEnsembleProvider-0] > org.apache.curator.ensemble.exhibitor.ExhibitorEnsembleProvider - Connection > string has changed. Old value (), new value > (172.19.2.158:2181,172.19.2.15:2181,172.19.2.177:2181,172.19.2.4:2181,172.19.2.89:2181,172.19.2.72:2181) > 2017-01-27T22:56:20,734 WARN [Agents-0-SendThread(127.0.0.1:2181)] > org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected > error, closing socket connection and attempting reconnect > java.net.ConnectException: Connection refused: no further information > at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) > ~[?:1.8.0_74] > at > sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) > ~[?:1.8.0_74] > at > org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) > ~[zookeeper-3.4.5.jar:3.4.5-1392090] > at > org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) > [zookeeper-3.4.5.jar:3.4.5-1392090] > 2017-01-27T22:56:21,835 INFO [Agents-0-SendThread(127.0.0.1:2181)] > org.apache.zookeeper.ClientCnxn - Opening socket connection to server > 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL > (unknown error) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)