kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING on windows

  apache-kafka, apache-zookeeper, windows

I am trying to start apache server on my windows machine. But while doing so i get this error kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING and the process stops. Note that i have zookeeper process started before running this and it started fine.

console log for zookeeper below:-

[2021-02-20 16:24:30,818] INFO Server environment:java.library.path=C:Program Files (x86)Javajdk-15.0.2bin;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;"C:UsersRipeshAppDataLocalMicrosoftWindowsApps;C:Program Files (x86)Javajdk-15.0.2bin";;. (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,826] INFO Server environment:java.io.tmpdir=C:UsersRipeshAppDataLocalTemp 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,826] INFO Server environment:java.compiler=<NA> 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,834] INFO Server environment:os.name=Windows 10 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,834] INFO Server environment:os.arch=amd64 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,842] INFO Server environment:os.version=10.0 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,850] INFO Server environment:user.name=Ripesh 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,850] INFO Server environment:user.home=C:UsersRipesh 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:user.dir=C:kafka2.7 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:os.memory.free=497MB 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:os.memory.max=512MB 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,866] INFO Server environment:os.memory.total=512MB 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,882] INFO minSessionTimeout set to 6000 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,882] INFO maxSessionTimeout set to 60000 
(org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,898] INFO Created server with tickTime 3000 minSessionTimeout 6000 
maxSessionTimeout 60000 datadir C:kafka2.7zookeeperversion-2 snapdir C:kafka2.7zookeeperversion-2 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,938] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2021-02-20 16:24:30,946] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 8 worker threads, and 64 kB direct buffers. (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2021-02-20 16:24:30,946] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2021-02-20 16:24:30,972] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
[2021-02-20 16:24:30,979] INFO Snapshotting: 0x0 to C:kafka2.7zookeeperversion-2snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog)   
[2021-02-20 16:24:30,984] INFO Snapshotting: 0x0 to C:kafka2.7zookeeperversion-2snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2021-02-20 16:24:31,008] INFO Using checkIntervalMs=60000 maxPerMinute=10000 (org.apache.zookeeper.server.ContainerManager)
[2021-02-20 16:29:39,625] INFO Creating new log file: log.1 (org.apache.zookeeper.server.persistence.FileTxnLog)
[2021-02-20 16:29:58,708] INFO Expiring session 0x100011044520000, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:48:34,467] INFO Expiring session 0x100011044520001, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:48:34,471] INFO Expiring session 0x100011044520002, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)

Error log in console when kafka server started:-

[2021-02-20 16:24:30,818] INFO Server environment:java.library.path=C:Program Files (x86)Javajdk-15.0.2bin;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;"C:UsersRipeshAppDataLocalMicrosoftWindowsApps;C:Program Files (x86)Javajdk-15.0.2bin";;. (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,826] INFO Server environment:java.io.tmpdir=C:UsersRipeshAppDataLocalTemp (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,826] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,834] INFO Server environment:os.name=Windows 10 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,834] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,842] INFO Server environment:os.version=10.0 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,850] INFO Server environment:user.name=Ripesh (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,850] INFO Server environment:user.home=C:UsersRipesh (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:user.dir=C:kafka2.7 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:os.memory.free=497MB (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,858] INFO Server environment:os.memory.max=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,866] INFO Server environment:os.memory.total=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,882] INFO minSessionTimeout set to 6000 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,882] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,898] INFO Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 datadir C:kafka2.7zookeeperversion-2 snapdir C:kafka2.7zookeeperversion-2 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:24:30,938] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2021-02-20 16:24:30,946] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 8 worker threads, and 64 kB direct buffers. (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2021-02-20 16:24:30,946] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2021-02-20 16:24:30,972] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
[2021-02-20 16:24:30,979] INFO Snapshotting: 0x0 to C:kafka2.7zookeeperversion-2snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2021-02-20 16:24:30,984] INFO Snapshotting: 0x0 to C:kafka2.7zookeeperversion-2snapshot.0 (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2021-02-20 16:24:31,008] INFO Using checkIntervalMs=60000 maxPerMinute=10000 (org.apache.zookeeper.server.ContainerManager)
[2021-02-20 16:29:39,625] INFO Creating new log file: log.1 (org.apache.zookeeper.server.persistence.FileTxnLog)
[2021-02-20 16:29:58,708] INFO Expiring session 0x100011044520000, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:48:34,467] INFO Expiring session 0x100011044520001, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2021-02-20 16:48:34,471] INFO Expiring session 0x100011044520002, timeout of 18000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)

It looks from log there is a 18000msec timeout defined. But when i tried to find this property in server.properties i could not find it out. Strangely after a few mins when i started kafka server process again i was able to start it without any issues.

Thanks

Source: Windows Questions

LEAVE A COMMENT