Consumer offset "stuck" on certain partitions

See original GitHub issue

Observed behavior I consume messages from a topic and this topic has 24 partitions. I started to consume from beginning and at first everything was fine but after some time the consumer stopped consuming messages from certain partitions.

The issue itself is very similar to this issue (562) but I’m using the current version of KafkaJS (v1.15.0) so I’m at a loss what the problem could be. As far as I’m aware the topic also uses log compaction.

I wrote a simple partition assigner that I programmed to only consume from partitions that were “stuck”. After that I added some console.log messages into the KafkaJS code (consumerGroup.js) to debug the problem further. I came to the point that I always got zero messages in the response from broker.fetch.

This was the response:

[
  {
    topicName: "MyTopic",
    partitions: [
      {
        partition: 1,
        errorCode: 0,
        highWatermark: "532672",
        lastStableOffset: "532672",
        lastStartOffset: "0",
        abortedTransactions: [],
        preferredReadReplica: -1,
        messages: [],
      },
    ],
  }
]

The offset that was used to fetch the next messages was like this: { MyTopic: { '1': '484158' } }

There are clearly still messages to consume but it always fetches zero because always the offset 484158 is used. I changed the offset manually via the admin interface to a higher and valid offset and after that the consumer worked again.

Expected behavior I would expect to receive all messages until the latest offset.

Environment:

  • OS: Mac OS 10.15.7
  • KafkaJS version 1.15.0
  • Kafka version 2.6.1
  • NodeJS version 12.18.3

Additional context If further logs are needed I can provide them. I couldn’t see any useful debug messages for this problem…

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
ThomasFerrocommented, Jun 10, 2021

Hi,

We have what seems to be a similar issue.

One of our partition is stuck at the same offset for our three consumer groups. It also is a compacted topic and using eachMessage instead of eachBatch does not help.

How could we help resolving the issue ? Do you know any workaround other than moving the offset manually ?

Thanks !

3reactions
anaistournoisAdeocommented, Feb 4, 2022

Hi,

We too have had the same issue twice this week. Each time one or two partitions from a 3-partitions topic were stuck at the same offset for all our consumer groups (This topic is compacted too). Do you know if someone made progress on this issue? Is there a way we can help solve it?

Thanks in advance

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kafka Consumer Hung on Certain Partitions - Stack Overflow
In my test environment, I have three Kafka brokers and my topic is having 16 partitions, there are 16 IOT Devices which post...
Read more >
Kafka consumers gets stuck for some partitions - Apache
We recently upgraded to Kafka 0.10.1.0. We are frequently facing issue that Kafka consumers get stuck suddenly for some partitions.
Read more >
Stuck on Kafka - Jesse Yates
- lead to 'out of order' commits that appear to cause a consumer group to become “stuck” at an offset.
Read more >
Kafka detecting lagging or stalled partitions - Unravel Data
Overview · OK: commit offset is in pace with the log end offset. · Lagging: the Consumer is lagging behind the Producer. Both...
Read more >
Is there any change in consumer offsets if a new partition s is ...
Yes, it stays the same. An offset is maintained for each partition separately, so your new partition's offset will start from 0 and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found