Error in Zookeeper : Unreasonable length = 308375649 when creating topic in Kafka
Asked Answered
C

4

13

I am setting up Kafka on my local Windows 10 machine. So downloaded all the required binaries and updated the two settings server and zookeeper properties as per the documentation.

But when running the Kafka create topic command

kafka-topics.bat --create --bootstrap-server 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic testtopic

I am getting below error in the Zookeeper window

WARN Close of session 0x0 (org.apache.zookeeper.server.NIOServerCnxn)
java.io.IOException: Unreasonable length = 308375649
        at org.apache.jute.BinaryInputArchive.checkLength(BinaryInputArchive.java:166)
        at org.apache.jute.BinaryInputArchive.readBuffer(BinaryInputArchive.java:127)
        at org.apache.zookeeper.proto.ConnectRequest.deserialize(ConnectRequest.java:91)
        at org.apache.zookeeper.server.ZooKeeperServer.processConnectRequest(ZooKeeperServer.java:1350)
        at org.apache.zookeeper.server.NIOServerCnxn.readConnectRequest(NIOServerCnxn.java:419)
        at org.apache.zookeeper.server.NIOServerCnxn.readPayload(NIOServerCnxn.java:180)
        at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:339)
        at org.apache.zookeeper.server.NIOServerCnxnFactory$IOWorkRequest.doWork(NIOServerCnxnFactory.java:522)
        at org.apache.zookeeper.server.WorkerService$ScheduledWorkRequest.run(WorkerService.java:154)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Can somebody help me here?

Comp answered 14/4, 2022 at 5:33 Comment(1)
Voting to close as typo. Port 2181 is Zookeeper, not a bootstrap-server (the Kafka server on port 9092). Also please read confluent.io/blog/set-up-and-run-kafka-on-windows-linux-wsl-2Ianthe
M
35

I faced similar issue, because I was trying to connect to the zookeeper instance (Port 2181) while providing the --bootstrap-server option. Later, I provided the Kafka broker details (localhost:9092) & it worked fine.

In the older Kafka version, we used to provide --zookeeper option & hence its instance.

Try this command -

bin/kafka-topics.sh --create --topic testtopic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
Meridithmeriel answered 2/5, 2022 at 10:36 Comment(1)
Think you misspelt port name in the command : 9092 instead of 2181Satinwood
H
6

The issue seems to be because of change between old Kafka/Zookeeper setup vs new one. In old one we were supposed to use --zookeeper option and port 2181 (by default); however with new Kafka/Zookeeper versions user is expected to use port 9092 by default with customer APIs. We get error java.io.IOException: Unreasonable length when API is issued using new Kafka with port 2181.

Hepplewhite answered 29/4, 2023 at 20:29 Comment(0)
G
2

Use the following command kafka-topics.bat --describe --topic testtopic --bootstrap-server localhost:9092

Guerrero answered 7/6, 2022 at 22:57 Comment(1)
kafka-topics.bat --create --topic testtopic --bootstrap-server localhost:9092Guerrero
U
0

unreasonable length = 308375649 in zookeeper Thank you dhanesh24g, helped me to resolved issue.

bin/kafka-topics.sh --create --topic testtopic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1

I copied from old kafka topics so it had zookeeper and and zookeeper port. I modified --zookeeper to --bootstrap-server and but didnt notice the port.

Unlock answered 28/4 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.