You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Oleg Zhurakousky <oz...@hortonworks.com> on 2016/03/28 20:00:05 UTC

Stopping background ZK reconnect thread

Guys

When stopping ‘ConsumerConnector’ by calling shutdown() one would assume that it is stopped, but it turns out it is not, since there is a background thread running infinitely that attempts to reconnect to ZK. The best way to reproduce it is to stop ZK and you will immediately start seeing the following:

13:35:03,809  WARN pool-29-thread-1-SendThread(localhost:2181) zookeeper.ClientCnxn:1102 - Session 0x153be441e2c0002 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

Is there a remedy for that? The issue is that every time we re-start component that uses ‘ConsumerConnector’ it essentially results in the new reconnect thread like the one above as if we had two consumers and so on upon each restart.

Cheers
Oleg