lucasbru commented on code in PR #14746: URL: https://github.com/apache/kafka/pull/14746#discussion_r1397061812
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java: ########## @@ -52,6 +53,8 @@ public class FetchBuffer implements AutoCloseable { private final Condition notEmptyCondition; private final IdempotentCloser idempotentCloser = new IdempotentCloser(); + private final AtomicBoolean wakedUp = new AtomicBoolean(false); Review Comment: nit: wokenUp? ########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java: ########## @@ -185,6 +188,16 @@ void awaitNotEmpty(Timer timer) { } } + void wakeup() { Review Comment: nit: `wakeup` vs. `wakeUp` capitalization ########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java: ########## @@ -166,7 +169,7 @@ void awaitNotEmpty(Timer timer) { try { lock.lock(); - while (isEmpty()) { + while (isEmpty() && !wakedUp.compareAndSet(true, false)) { Review Comment: Nice! I was first convinced that we have an interleaving here that misses the wakeup, but `wakedUp` takes care. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org