chickenchickenlove opened a new pull request, #23443:
URL: https://github.com/apache/kafka/pull/23443

   `AsyncKafkaConsumer.poll(Duration)` calls `FetchCollector.collectFetch()` 
through `pollForFetches()`.
   
   `collectFetch()` preserves fetches from paused partitions by requeuing them 
through `FetchBuffer.addAll()`. However, `addAll()` also calls 
`wokenup.set(true)` and `blockingCondition.signalAll()`.
   
   When only paused fetches remain, collection returns an empty result, and 
`pollForFetches()` calls `fetchBuffer.awaitWakeup(pollTimer)`. Since 
`wokenup.compareAndSet(true, false)` succeeds, the method returns immediately 
without calling `Condition.await()`.
   
   Subsequent collections requeue the same paused fetches and regenerate the 
wakeup signal. This can cause the application thread to repeatedly execute the 
internal `poll()` loop until the timeout expires, consuming CPU without new 
responses or consumption progress.
   
   This change introduces `requeue()`, which preserves the existing wakeup 
state, and uses it to restore paused fetches without   generating unnecessary 
wakeup signals.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to