解决Kafka Error reading field ‘topic_metadata’: Error reading array of size 1702065152, only 29 bytes available问题

错误信息

[ERROR] 2018-11-07 20:20:01,378 method:org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:137)
Uncaught error in kafka producer I/O thread: 
org.apache.kafka.common.protocol.types.SchemaException: Error reading field 'topic_metadata': Error reading array of size 1702065152, only 29 bytes available
    at org.apache.kafka.common.protocol.types.Schema.read(Schema.java:73)
    at org.apache.kafka.clients.NetworkClient.parseResponse(NetworkClient.java:380)
    at org.apache.kafka.clients.NetworkClient.handleCompletedReceives(NetworkClient.java:449)
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:269)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:236)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:135)
    at java.lang.Thread.run(Thread.java:748)

 

问题解决

这里的异常是因为项目中kafka和kafka-client的版本不一致造成的,改为一致的版本就可以解决。