Skip to content

Log exceptions in TcpTransport at DEBUG level#51612

Merged
DaveCTurner merged 3 commits intoelastic:masterfrom
DaveCTurner:2020-01-29-less-extreme-logging-in-TcpTransport
Jan 31, 2020
Merged

Log exceptions in TcpTransport at DEBUG level#51612
DaveCTurner merged 3 commits intoelastic:masterfrom
DaveCTurner:2020-01-29-less-extreme-logging-in-TcpTransport

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

When running Elasticsearch on a flaky network, we may see nodes leaving the
cluster with reason disconnected. It may be useful to the cluster
administrator to see the full exception that caused the disconnection, but this
is only available with TRACE level logging which commingles the details of
the problem with other messages that are not useful to end users.

This commit promotes logging of exceptions in TcpTransport from TRACE to
DEBUG to separate them from the truly TRACE-level messages.

When running Elasticsearch on a flaky network, we may see nodes leaving the
cluster with reason `disconnected`. It may be useful to the cluster
administrator to see the full exception that caused the disconnection, but this
is only available with `TRACE` level logging which commingles the details of
the problem with other messages that are not useful to end users.

This commit promotes logging of exceptions in `TcpTransport` from `TRACE` to
`DEBUG` to separate them from the truly `TRACE`-level messages.
@DaveCTurner DaveCTurner added >non-issue :Distributed/Network Http and internode communication implementations v8.0.0 v7.7.0 labels Jan 29, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (:Distributed/Network)

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

Makes sense IMO => LGTM

Loggers.removeAppender(LogManager.getLogger(TcpTransport.class), appender);
appender.stop();
IOUtils.close(tcpTransport);
testThreadPool.shutdown();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: Maybe use org.elasticsearch.threadpool.ThreadPool#terminate(java.util.concurrent.ExecutorService, long, java.util.concurrent.TimeUnit) here so we don't get the leaked thread warning when running this one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TIL. Yes, done in f0e813b.

Copy link
Copy Markdown
Contributor

@Tim-Brooks Tim-Brooks left a comment

Choose a reason for hiding this comment

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

If we are going to implement these tests can we extract the exception handling to a separate class and test in a manner that does not require overriding the transport? See SecurityHttpExceptionHandler as a place where we extracted exception handling from the http transport.

@DaveCTurner
Copy link
Copy Markdown
Member Author

Not sure of the value of a whole nother class for this, how about a static method? See a62032c.

Copy link
Copy Markdown
Contributor

@Tim-Brooks Tim-Brooks left a comment

Choose a reason for hiding this comment

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

LGTM

@DaveCTurner
Copy link
Copy Markdown
Member Author

@elasticmachine please run elasticsearch-ci/default-distro

@DaveCTurner DaveCTurner merged commit 336a395 into elastic:master Jan 31, 2020
@DaveCTurner DaveCTurner deleted the 2020-01-29-less-extreme-logging-in-TcpTransport branch January 31, 2020 01:12
DaveCTurner added a commit that referenced this pull request Jan 31, 2020
When running Elasticsearch on a flaky network, we may see nodes leaving the
cluster with reason `disconnected`. It may be useful to the cluster
administrator to see the full exception that caused the disconnection, but this
is only available with `TRACE` level logging which commingles the details of
the problem with other messages that are not useful to end users.

This commit promotes logging of exceptions in `TcpTransport` from `TRACE` to
`DEBUG` to separate them from the truly `TRACE`-level messages.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Dec 15, 2021
In elastic#51612 we promoted certain log messages regarding unexpected network
exceptions from `TRACE` to `DEBUG`. In fact it's often useful to see
these exceptions by default, so with this commit we show the message
(but not the stack trace) at `INFO` level. This commit also adds some
commentary about what each of the exceptions means.

Closes elastic#66473
DaveCTurner added a commit that referenced this pull request Dec 16, 2021
In #51612 we promoted certain log messages regarding unexpected network
exceptions from `TRACE` to `DEBUG`. In fact it's often useful to see
these exceptions by default, so with this commit we show the message
(but not the stack trace) at `INFO` level. This commit also adds some
commentary about what each of the exceptions means.

Closes #66473
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Network Http and internode communication implementations >non-issue v7.7.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants