Skip to content
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

Log only first exception in the connection exception handler #1107

Merged
merged 2 commits into from
Jan 25, 2018

Conversation

merlimat
Copy link
Contributor

Motivation

After the switch to Netty-4.1, we have seen that when a connection is reset all the pending write operations are triggering a NativeIoException that is caught and logged in the exceptionCaught() handler.

If there are many topics sharing a given connection, this can print several thousand exception stacktraces for all the pending writes.

Modification

  • Only log the first exception occurrence, and silence all subsequent errors since the connection is being closed anyway.
  • Do not print stack traces for well known exceptions that are triggered on connections resets.

@merlimat merlimat added this to the 1.22.0-incubating milestone Jan 24, 2018
@merlimat merlimat self-assigned this Jan 24, 2018
@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Jan 24, 2018
Copy link
Contributor

@rdhabalia rdhabalia left a comment

Choose a reason for hiding this comment

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

👍
LGTM..just a minor comment.

log.warn("[{}] Got exception {} : {}", remoteAddress, cause.getClass().getSimpleName(),
cause.getMessage());
} else {
log.warn("[{}] Got exception: {}", remoteAddress, cause.getMessage(), cause);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead duplicate logging logic, should we do:

log.warn("[{}] Got exception: {}", remoteAddress, cause.getMessage(), (cause instanceof NativeIoException) ? cause ? null);

@merlimat merlimat merged commit f57cd88 into apache:master Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants