Skip to content

Fix StringBuilder cache corruption on recursive access #2275

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

Merged
merged 6 commits into from
Feb 10, 2024

Conversation

vy
Copy link
Member

@vy vy commented Feb 9, 2024

No description provided.

@vy vy added this to the 2.23.0 milestone Feb 9, 2024
@vy vy requested a review from ppkarwasz February 9, 2024 09:49
@vy vy self-assigned this Feb 9, 2024
Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

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

This certainly looks great and builds up on your work on main, but do we really need to backport StringBuilderRecycler to 2.x?

This is an edge case that is only triggered, if we two nested log calls. I would prefer a fix with the minimal amount of LOCs required. In this case I think that ParameterizedMessage needs a:

private static final ThreadLocal<AtomicInteger> recursionCount;

field.

Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

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

LGTM

@vy
Copy link
Member Author

vy commented Feb 9, 2024

I would prefer a fix with the minimal amount of LOCs required.

You are right. I have changed the implementation as you suggested and it indeed looks better. 💯 Thanks for the review. 😍

@vy vy merged commit c6832d6 into 2.x Feb 10, 2024
@vy vy deleted the 2.x-fix-api-recursive-formatting branch February 10, 2024 18:48
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.

2 participants