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

LOG4J2-3060 Fix integer overflow in DefaultErrorHandler #481

Closed
wants to merge 1 commit into from

Conversation

Noobgam
Copy link

@Noobgam Noobgam commented Apr 2, 2021

When configured incorrectly, the ErrorHandler::error method will be called very often. As an example of such behavior, you can try stopping the appender manually.

This will result in ErrorHandler::error("Attempted to append to non-started appender {...}") which may or may not be called often. In our scenario, this happened ~4k-20k times per second. Although everything seems normal at first, exceptionCount keeps getting incremented until it overflows after 2^31 increments.

When it overflows, every such method call will enter the branch leading to very high CPU consumption in useless code and a significant spike in System.out throughput
image

@carterkozak
Copy link
Contributor

Thank you for reporting, great find! Would you mind filing jira issue for tracking here?

@Noobgam Noobgam changed the title Fix integer overflow in DefaultErrorHandler LOG4J2-3004 Fix integer overflow in DefaultErrorHandler Apr 2, 2021
@Noobgam
Copy link
Author

Noobgam commented Apr 2, 2021

@vy vy changed the title LOG4J2-3004 Fix integer overflow in DefaultErrorHandler LOG4J2-3060 Fix integer overflow in DefaultErrorHandler Apr 3, 2021
Copy link
Member

@rgoers rgoers left a comment

Choose a reason for hiding this comment

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

This looks good to me. It needs to be back-ported to releaes-2.x. I believe we should be able to cherry pick the commit.

@zhurs
Copy link

zhurs commented Sep 27, 2021

@rgoers
I met this problem in my production.
What can we do to merge this fix?

@vy
Copy link
Member

vy commented Nov 8, 2021

Superseded by #597.

@vy vy closed this Nov 8, 2021
@Noobgam Noobgam deleted the patch-1 branch March 29, 2022 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants