[ https://issues.apache.org/jira/browse/CURATOR-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kezhu Wang closed CURATOR-385. ------------------------------ Resolution: Abandoned This class has been deleted in upgrading to 5.0.0. See Curator-558. > Synchronize startup of ExhibitorEnsembleProvider and Zookeeper connection > ------------------------------------------------------------------------- > > Key: CURATOR-385 > URL: https://issues.apache.org/jira/browse/CURATOR-385 > Project: Apache Curator > Issue Type: Improvement > Components: Client > Affects Versions: 2.10.0 > Reporter: Egor Ryashin > Priority: Major > Original Estimate: 72h > Remaining Estimate: 72h > > Right now starting CuratorFramework with ExhibitorEnsembleProvider could > cause faulty zookeeper connection. > To check this 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} > As a workaround a user could poll for connection string using that provider > beforehand. > The goal of the improvement is to allow user to call CuratorFramework.start() > and got a working framework without an additional poll method call. Using > poll before start() actually uncovers implementation details and is a vague > technique for a general user. -- This message was sent by Atlassian Jira (v8.20.10#820010)