-
Notifications
You must be signed in to change notification settings - Fork 15.4k
MINOR: Improve confusing admin client shutdown logging #10107
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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."); | ||
| } catch (InterruptedException e) { | ||
| log.debug("Interrupted while joining I/O thread", e); | ||
| Thread.currentThread().interrupt(); | ||
|
|
@@ -756,6 +756,11 @@ protected Node curNode() { | |
| return curNode; | ||
| } | ||
|
|
||
| void abortAndFail(Throwable throwable) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about changing the input type from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. |
||
| this.aborted = true; | ||
| fail(time.milliseconds(), throwable); | ||
| } | ||
|
|
||
| /** | ||
| * Handle a failure. | ||
| * | ||
|
|
@@ -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)); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -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++; | ||
|
|
@@ -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.")); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -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); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.