Lianet Magrans created KAFKA-16766:
--------------------------------------
Summary: New consumer offsetsForTimes timeout exception does not
have the proper message
Key: KAFKA-16766
URL: https://issues.apache.org/jira/browse/KAFKA-16766
Project: Kafka
Issue Type: Bug
Components: consumer
Affects Versions: 3.7.0
Reporter: Lianet Magrans
Fix For: 3.8.0
If a call to consumer.offsetsForTimes times out, the new AsyncKafkaConsumer
will throw a org.apache.kafka.common.errors.TimeoutException as expected, but
with the following as message: "java.util.concurrent.TimeoutException".
We should provide a clearer message, and I would even say we keep the same
message that the LegacyConsumer shows in this case, ex: "Failed to get offsets
by times in 60000ms".
To fix this we should consider catching the timeout exception in the consumer
when offsetsForTimes result times out
([here|https://github.com/apache/kafka/blob/0e023e1f736ea03568032cc282803df8e61eb451/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1115]),
and propagate it with the message specific to offsetsForTimes.
After the fix, we should be able to write a test like the
[testOffsetsForTimesTimeout|https://github.com/apache/kafka/blob/0e023e1f736ea03568032cc282803df8e61eb451/clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java#L3246]
that exist for the legacy consumer. Note that we would need a different test
given that the legacy consumer does not issue a FindCoordinator request in this
case but the AsyncConsumer does, so the test would have to account for that
when matching requests/responses.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)