Skip to content

Kafka consumer skipped a failing message after stop/rebalance #253

Description

@Anwert

Environment

  • Managed Kafka cluster (Confluent Cloud)
  • Topic with multiple partitions
  • Multiple replicas in the same consumer group

Relevant configuration

Error policy:

policy
    .Retry(retryCount, initialDelay, delayIncrement)
    .ThenStop();
  • EnableAutoCommit is left at Confluent default (true).

Summary

We saw a single incident where a message at offset N consistently failed, the consumer stopped, and after rebalance the group resumed from N+1 (skipping N). Before that, we had two normal stop/restart cycles where the failing message at N was retried again as expected. We cannot reproduce it so far.


Timeline (from logs)

For partition P, offset N:

  1. P@N is consumed, processing starts.

  2. Business code throws on every attempt.

  3. Silverback retries multiple times; logs show the same offset P@N on each attempt.

  4. After the last attempt, Silverback logs fatal stop:

    • “Fatal error occurred… The consumer will be stopped… offset: [P]@N …”
  5. The very next log line is the rebalance revoke:

    • Incident: “Revoked partition [P] (offset was N+1)”
    • Normal/expected when consumer stops after failures:
      “Revoked partition [P] (offset was -1001)”
  6. The partition is assigned to another consumer in the same group, and it resumes from N+1, effectively skipping P@N.


Questions / pointers

At the moment the only thing that stands out to us is auto-commit. Could auto-commit (EnableAutoCommit=true) realistically cause the committed group offset to advance to N+1 in this kind of “retry → stop → immediate rebalance” flow, even though the message at N never succeeded?

If auto-commit alone shouldn’t explain this, do you have any ideas what else could affect the committed offset / starting position after rebalance in Silverback/Confluent.Kafka (e.g., revoke/assign behavior, commit-on-revoke, shutdown sequence, etc.)?


Thanks a lot in advance for any guidance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions