📝 Issue Description
I encountered a WakeUpException thrown from a method that includes the comment
“wakeups are not expected.”
/**
* Ensure that the coordinator is ready to receive requests. This will return
* immediately without blocking. It is intended to be called in an asynchronous
* context when wakeups are not expected.
*
* @return true if coordinator discovery and initial connection succeeded,
false otherwise
*/
protected synchronized boolean ensureCoordinatorReadyAsync() {
return ensureCoordinatorReady(time.timer(0), true);
}
After digging into the issue, I found that the exception originates from the
following line:
client.awaitMetadataUpdate(timer);
which may cause the WakeUpException.
Here’s the relevant code snippet:
if (future.failed()) {
if (future.isRetriable()) {
log.debug("Coordinator discovery failed, refreshing metadata",
future.exception());
timer.sleep(retryBackoff.backoff(attempts++));
client.awaitMetadataUpdate(timer);
} else {
fatalException = future.exception();
log.info("FindCoordinator request hit fatal exception", fatalException);
}
}
Inside client.awaitMetadataUpdate, the implementation uses poll(),
but it does not call it with disableWakeup = true.
💬 Discussion
We may need to:
Investigate whether awaitMetadataUpdate() should support a non-wakeup mode for
async use.
Consider passing disableWakeup = true (if possible) when used in this
asynchronous context.