Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka consumer gets stuck after exceeding max.poll.interval.ms

When the consumer does not receives a message for 5 mins (default value of max.poll.interval.ms 300000ms) the consumer comes to a halt without exiting the program. The consumer process hangs and does not consume any more messages.

The following error message gets logged

MAXPOLL|rdkafka#consumer-1| [thrd:main]: Application maximum poll interval (300000ms) exceeded by 255ms (adjust max.poll.interval.ms for long-running message processing): leaving group

I see that ErrMaxPollExceeded is defined here in confluent-kafka-go but unable to find where it is getting raised.

If any such error is raised, why does the program not exit ?

  • Kafka v1.1.0
  • librdkafka v1.0.0
  • confluent-kafka-go (master)

Config used for kafka.Consumer

{
    "bootstrap.servers":    "private.kafka.host",
    "group.id":             "foo.bar",
    "auto.offset.reset":    "earliest",
    "enable.auto.commit":   false,
}
like image 645
esquarer Avatar asked Jun 24 '19 10:06

esquarer


1 Answers

It looks like this is a reported issue to the confluent-kafka-go client: https://github.com/confluentinc/confluent-kafka-go/issues/344

It is marked as resolved by this change which should have been released in librdkafka version 1.1.0: https://github.com/edenhill/librdkafka/commit/80e9b1ee0c0e477c02f18b130c4302240711a88d

It looks like that change should also have been released in confluent-kafka-go version 1.1.0: https://github.com/confluentinc/confluent-kafka-go/tree/v1.1.0

Some comments in the issue still report that this is an issue experiences on versions >1.1.0.

A commenter suggests a work around:

Using v1.5.2. Also calling ReadMessage(-1) in an infinite loop, and not seeing rejoining after consumer leaving group, worked around it by setting timeout to be less than max.poll.interval.ms instead of -1, but wondering why it's not rejoining as expected.

https://github.com/confluentinc/confluent-kafka-go/issues/344#issuecomment-745014864

like image 106
dolan Avatar answered Nov 20 '22 03:11

dolan