question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consume read messages already commited

See original GitHub issue

Hi,

I face a problem since few weeks. Sometimes the consumer function give me the message with offset 0, even i consumed him long time ago And it makes me read again all messages. I tried on a local kafka and another kafka instance and both have the same problem.

Here is my code :

        private Dictionary<string, object> _constructConfig(string brokerList, bool enableAutoCommit) =>
            new Dictionary<string, object>
            {
                {"group.id", "jokerGroup"},
                {"enable.auto.commit", enableAutoCommit},
                {"auto.commit.interval.ms", 5000},
                {"statistics.interval.ms", 60000},
                {"bootstrap.servers", brokerList},
                {
                    "default.topic.config", new Dictionary<string, object>
                    {
                        {"auto.offset.reset", "smallest"}
                    }
                }
            };
                while (foundMessage == false && nbRetry < 20)
                {
                    while (consumer.Consume(out msg, TimeSpan.FromMilliseconds(1000)))
                    {
                        foundMessage = true;
                        ....
                   }
                }
        public async Task<CommittedOffsets> CommitAsync(Consumer<Null, string> consumer, Message<Null, string> msg)
        {
            CommittedOffsets offsets = await consumer.CommitAsync(msg);
            _logger.LogInformation(LogEvent.NeedCreateCode, $"COMMIT : {offsets.Offsets.FirstOrDefault()}");

            return offsets;
        }

This problem happend randomly, i have no more informations (Maybe every 24h ?) And i also read kafka on my windows using basics scripts and sometimes i got this warning (Maybe it can help us to find the issue) :

[2018-03-09 13:23:34,135] WARN Auto-commit of offsets {JokerTopic-0=OffsetAndMetadata{offset=10, metadata=‘’}} failed for group console-consumer-82368: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)

Thank you for your precious help !

Confluent.Kafka nuget version: v0.11.3-ci-255 Operating system: W10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Oipocommented, Mar 20, 2018

One of the kafka instances in the cluster was broken, leading to different offsets in the leader and the follower. Thanks for the help.

0reactions
Oipocommented, Mar 20, 2018

Is there a way to log this debug to a file? The service is running under an account without rights to login to a console.

Edit: Got it working with stderr redirection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to read the messages from kafka which are already ...
I have requirement in kafka, want to read the messages from kafka which are already committed instead of all messages.
Read more >
A Consumer seems to consume messages already ...
I've solved this problem. it was my mistake. When manually committing already processed message, I should've added 1 to offset to call Consumer....
Read more >
Chapter 4. Kafka Consumers: Reading Data from Kafka
Applications that need to read data from Kafka use a KafkaConsumer to subscribe to Kafka topics and receive messages from these topics. Reading...
Read more >
Consuming messages
If the committed offset overtakes the processing of the messages and a consumer failure exists, it's possible that some messages are not processed....
Read more >
How to read from a specific offset and partition ...
If you haven't done so already, close the previous console consumer with a CTRL+C . From the previous step you know there are...
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