Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ public void close(Duration timeout) {
// Wait for the thread to be joined.
thread.join(waitTimeMs);
}
log.debug("Kafka admin client closed.");
log.info("Kafka admin client closed.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if changing this log level is really necessary. What's the rational behind it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is helpful to get at least one log message at info level in shutdown. Really at the start of shutdown is best since it triggers logic which can be difficult to explain if you don't know shutdown is taking place. Anyway, let me remove this change here and I can open a separate patch so that we can do this consistently in all the clients.

} catch (InterruptedException e) {
log.debug("Interrupted while joining I/O thread", e);
Thread.currentThread().interrupt();
Expand Down Expand Up @@ -756,6 +756,11 @@ protected Node curNode() {
return curNode;
}

void abortAndFail(Throwable throwable) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing the input type from Throwable to TimeoutException? The exception passed to this method should NOT be wrapped by TimeoutException. Using explicit type (TimeoutException) can prevent us from passing incorrect exception in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

this.aborted = true;
fail(time.milliseconds(), throwable);
}

/**
* Handle a failure.
*
Expand Down Expand Up @@ -818,8 +823,12 @@ private void failWithTimeout(long now, Throwable cause) {
log.debug("{} timed out at {} after {} attempt(s)", this, now, tries,
new Exception(prettyPrintException(cause)));
}
handleFailure(new TimeoutException(this + " timed out at " + now
+ " after " + tries + " attempt(s)", cause));
if (cause instanceof TimeoutException) {
handleFailure(cause);
} else {
handleFailure(new TimeoutException(this + " timed out at " + now
+ " after " + tries + " attempt(s)", cause));
}
}

/**
Expand Down Expand Up @@ -1130,7 +1139,7 @@ private void timeoutCallsInFlight(TimeoutProcessor processor) {
if (call.aborted) {
log.warn("Aborted call {} is still in callsInFlight.", call);
} else {
log.debug("Closing connection to {} to time out {}", nodeId, call);
log.debug("Closing connection to {} due to timeout while awaiting {}", nodeId, call);
call.aborted = true;
client.disconnect(nodeId);
numTimedOut++;
Expand Down Expand Up @@ -1375,7 +1384,7 @@ void enqueue(Call call, long now) {
client.wakeup(); // wake the thread if it is in poll()
} else {
log.debug("The AdminClient thread has exited. Timing out {}.", call);
call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread has exited."));
call.abortAndFail(new TimeoutException("The AdminClient thread has exited."));
}
}

Expand All @@ -1390,7 +1399,7 @@ void enqueue(Call call, long now) {
void call(Call call, long now) {
if (hardShutdownTimeMs.get() != INVALID_SHUTDOWN_TIME) {
log.debug("The AdminClient is not accepting new calls. Timing out {}.", call);
call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread is not accepting new calls."));
call.abortAndFail(new TimeoutException("The AdminClient thread is not accepting new calls."));
} else {
enqueue(call, now);
}
Expand Down