You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2025/07/14 11:25:01 UTC
[PR] fix: Prevent `LogBuilder` memory leak in Log4j API to Logback bridge [logging-log4j2]
ppkarwasz opened a new pull request, #3824:
URL: https://github.com/apache/logging-log4j2/pull/3824
This change fixes a potential memory leak in the `log4j-to-slf4j` module (Logback Log4j API binding) caused by the use of a thread-local `LogBuilder` pool.
The leak occurred because the thread-local field was **accidentally accessed**, even when `log4j2.enableThreadlocals` was set to `false`. In servlet environments, this could lead to classloader leaks due to the persistence of thread-local references.
With this fix, all access to the `ThreadLocal` is now **properly** gated by the `log4j2.enableThreadlocals` system property—matching how similar pooling behavior is handled in Log4j Core.
This preserves the GC-free option for advanced users who explicitly opt in via `log4j2.enableThreadlocals = true`, while avoiding memory leaks for others.
Fixes #3819
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Prevent `LogBuilder` memory leak in Log4j API to Logback bridge [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy merged PR #3824:
URL: https://github.com/apache/logging-log4j2/pull/3824
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org