Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased CPU usage caused by a loop lasting 1ms max #4684

Closed
1 of 7 tasks
emasab opened this issue Apr 15, 2024 · 1 comment
Closed
1 of 7 tasks

Increased CPU usage caused by a loop lasting 1ms max #4684

emasab opened this issue Apr 15, 2024 · 1 comment
Labels

Comments

@emasab
Copy link
Collaborator

emasab commented Apr 15, 2024

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:

  • librdkafka version (1.x)
  • Apache Kafka version: <REPLACE with e.g., 0.10.2.3>
  • librdkafka client configuration: <REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
  • Operating system: <REPLACE with e.g., Centos 5 (x64)>
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue
@emasab emasab added the bug label Apr 15, 2024
@emasab
Copy link
Collaborator Author

emasab commented Apr 25, 2024

Fixed in #4671

@emasab emasab closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant