Hi, I maintain Kafka Lag Exporter (an offset lag/latency monitoring tool). I use the Apache Kafka Java AdminClient and KafkaConsumer to retrieve offset information to calculate lag and other metrics, similar to how the kafka-consumer-groups.sh bin script works. A few users have reported Kafka Lag Exporter crashing due to an internal AdminClient exception caused by the response from OffsetFetchRequest: "java.lang.IllegalArgumentException: Invalid negative offset" (see stack trace below).
We found out that the user is using Azure EventHub For Kafka and that partition offsets for consumer groups are initialized with offset -1. I've never heard of this practice before so I thought I'd ask if this is an initialization default, or a default that users/services do commonly when users don't want to use Kafka managed offsets. Since kafka-consumer-groups.sh relies on AdminClient, this issue can be reproduced using that script as well. Kafka Lag Exporter issue: https://github.com/lightbend/kafka-lag-exporter/issues/120 Stack trace: Caused by: java.lang.IllegalArgumentException: Invalid negative offset at org.apache.kafka.clients.consumer.OffsetAndMetadata.<init>(OffsetAndMetadata.java:50) at org.apache.kafka.clients.admin.KafkaAdminClient$25.handleResponse(KafkaAdminClient.java:3018) at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.handleResponses(KafkaAdminClient.java:1076) at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1204) ... 1 common frames omitted Regards, Sean
