Description
When the main thread loop is awakened less than 1 ms before the expiration of a timeout, it is serving with a zero timeout, leading to increased CPU usage until the timeout is reached
How to reproduce
Put a debug log in some of the functions that are called in main loop, like rd_kafka_cgrp_serve logging the time difference with the first timer being checked. You'll notice that when it's awakened less than a millisecond before the timer, like 1-999 microseconds before, the conversion to milliseconds gives 0, so it's serving with a 0 timeout in a loop until it's reached.
Checklist
Please provide the following information:
Description
When the main thread loop is awakened less than 1 ms before the expiration of a timeout, it is serving with a zero timeout, leading to increased CPU usage until the timeout is reached
How to reproduce
Put a debug log in some of the functions that are called in main loop, like
rd_kafka_cgrp_servelogging the time difference with the first timer being checked. You'll notice that when it's awakened less than a millisecond before the timer, like 1-999 microseconds before, the conversion to milliseconds gives 0, so it's serving with a 0 timeout in a loop until it's reached.Checklist
Please provide the following information:
<REPLACE with e.g., 0.10.2.3><REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..><REPLACE with e.g., Centos 5 (x64)>debug=..as necessary) from librdkafka