rd_kafka_query_watermark_offsets
continues beyond timeout expiry
#4878
Labels
rd_kafka_query_watermark_offsets
continues beyond timeout expiry
#4878
Description
When
rd_kafka_query_watermark_offsets
is called with a timeout below 1000ms it will most likely not timeout within that time.rd_kafka_query_watermark_offsets
sends one request to get the low watermark, and one request to get the high watermark. These requests are then put in a queue, which is checked every second to see if any request has timed out.If a response arrives before this check, indifferent to the request timeout, then
rd_kafka_query_watermark_offsets
returns the received offsets.#4460 contained a fix for the timeout, but was replaced with #4225 which gives the inaccurate timeout handling.
Proposed correction
Use a timeout when calling
rd_kafka_q_serve
.This is how its solved in other APIs like rd_kafka_list_groups and rd_kafka_offsets_for_times, and also used in #4460.
How to reproduce
Lower the timeout used in the testcase to a value under 1s, like 100ms.
Run testcase:
which gives a
NO_ERROR
, i.e. no timeout occurred inrd_kafka_query_watermark_offsets
.Note that the testcase took 0.166s. The issue has also been verified by "printf-debugging".
Optionally: update the mock to respond after 800ms, instead of
(int)(timeout_ms * 1.2))
, the call will still not timeout after 100ms.Checklist
v2.6.0
andmaster
3.4.0
debug=..
as necessary) from librdkafkaThe text was updated successfully, but these errors were encountered: