3

I recently attempted to consume messages from a Kafka topic and was greeted with the following error message:

[2016-08-15 17:56:05,025] INFO Closing socket connection to /192.168.34.11. (kafka.network.Processor)
[2016-08-15 17:56:05,050] ERROR Closing socket for /127.0.0.1 because of error (kafka.network.Processor)
kafka.common.KafkaException: Wrong request type 18
    at kafka.api.RequestKeys$.deserializerForKey(RequestKeys.scala:64)
    at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:50)
    at kafka.network.Processor.read(SocketServer.scala:450)
    at kafka.network.Processor.run(SocketServer.scala:340)
    at java.lang.Thread.run(Thread.java:745)
[2016-08-15 17:56:05,154] ERROR Closing socket for /127.0.0.1 because of error (kafka.network.Processor)
kafka.common.KafkaException: Wrong request type 16
    at kafka.api.RequestKeys$.deserializerForKey(RequestKeys.scala:64)
    at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:50)
    at kafka.network.Processor.read(SocketServer.scala:450)
    at kafka.network.Processor.run(SocketServer.scala:340)
    at java.lang.Thread.run(Thread.java:745)
[2016-08-15 17:56:10,476] ERROR Closing socket for /127.0.0.1 because of error (kafka.network.Processor)
java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
    at kafka.api.TopicDataSend.writeTo(FetchResponse.scala:123)
    at kafka.network.MultiSend.writeTo(Transmission.scala:101)
    at kafka.api.FetchResponseSend.writeTo(FetchResponse.scala:231)
    at kafka.network.Processor.write(SocketServer.scala:472)
    at kafka.network.Processor.run(SocketServer.scala:342)
    at java.lang.Thread.run(Thread.java:745)

As you can perhaps tell from the error message, the kafka broker is mapped to localhost - but beyond that, I can't really parse it, and it's been hard to find details on the error message "Wrong request type 18".

Anyone else have this issue?

Cœur
  • 37,241
  • 25
  • 195
  • 267
m81
  • 2,217
  • 5
  • 31
  • 47

3 Answers3

4

This error tells you the client sent a request that the broker could not understand. In your particular case, the client sent a ListGroupsRequest (request code 16) and ApiVersionsRequest (request code 18).

You can get the latest list of request codes here. This list is also available here but it looks a bit outdated, as the newest version contains more API keys.

To solve this issue you need to either upgrade your brokers or use an older client.

serejja
  • 22,901
  • 6
  • 64
  • 72
  • An upvote for confirming what I was suspecting my problem was. If you have an out-of-sync broker/client version, you'll run into this problem. In my case, I was using a much older broker version, and the latest client version, causing this communication exception. – JohnsonCore May 23 '19 at 18:41
1

The error seems to have gone away, but I don't think I made any changes; I'm not sure what happened exactly. Sorry for the useless question.

m81
  • 2,217
  • 5
  • 31
  • 47
0

You should assure that the Kafka versión that you are using to consume in the client is the same versión of the Kafka cluster. For example a simple kafka client with scala. libraryDependencies += "org.apache.kafka" % "kafka-clients" % "0.10.0.0" should be the same of the kafkacluster . enter image description here