Kafka Error fetching offset data. Reason: 1

1.6k views Asked by At

I'm running a java program that uses the kafka library and check the committed offset of a consumer group from zookeeper every 1 sec. the program runs well for about 2 hour and starts throwing RuntimeException:

java.lang.RuntimeException: Error fetching offset data. Reason: 1
    at com.pinterest.secor.common.KafkaClient.getMessage(KafkaClient.java:127)
    at com.pinterest.secor.common.KafkaClient.getCommittedMessage(KafkaClient.java:186)

...

What is reason 1? I couldn't find any document or pages illustrating the root cause of this situation.

1

There are 1 answers

0
Weibo Li On

Check this out, this is a code fragment of kafka.common.ErrorMapping:

  val UnknownCode : Short = -1
  val NoError : Short = 0
  val OffsetOutOfRangeCode : Short = 1
  val InvalidMessageCode : Short = 2
  val UnknownTopicOrPartitionCode : Short = 3
  val InvalidFetchSizeCode  : Short = 4
  val LeaderNotAvailableCode : Short = 5
  val NotLeaderForPartitionCode : Short = 6
  val RequestTimedOutCode: Short = 7
  val BrokerNotAvailableCode: Short = 8
  val ReplicaNotAvailableCode: Short = 9
  val MessageSizeTooLargeCode: Short = 10
  val StaleControllerEpochCode: Short = 11
  val OffsetMetadataTooLargeCode: Short = 12
  val StaleLeaderEpochCode: Short = 13
  val OffsetsLoadInProgressCode: Short = 14
  val ConsumerCoordinatorNotAvailableCode: Short = 15
  val NotCoordinatorForConsumerCode: Short = 16
  val InvalidTopicCode : Short = 17
  val MessageSetSizeTooLargeCode: Short = 18
  val NotEnoughReplicasCode : Short = 19
  val NotEnoughReplicasAfterAppendCode: Short = 20

As you can see, 1 means OffsetOutOfRangeCode.