[
https://issues.apache.org/jira/browse/LOG4J2-3661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Akshay Kumar updated LOG4J2-3661:
---------------------------------
Description:
* We have migrated from log4j 1 to log4j 2 using the bridge approach in our
Application.
** This issue occurs even after migrating the application to log4j2.
* We push the key-value pairs to print in logs as provided in the pattern
layout with the help of NDC and MDC.
* In log4j2 (bridge), this NDC internally uses ThreadContext to store the keys
and values.
* But it seems that there is some bug in the ThreadContext, as its stack keeps
increasing in size causing a high heap due to which the application starts
doing Full GC.
* And the application becomes slow.
* We push the logs in a queue and a single thread polls data from the queue
pushes data in NDC and MDC, logs data, pops dada from NDC MDC, and polls again
from the queue.
* It seems MDC is fine but NDC has some issues as the data in context stacks
(stored in ThreadContext used for NDC operations) keeps increasing but the
context map (stored in ThreadContext used for MDC operations) seems fine.
was:
* We have migrated from log4j 1 to log4j 2 using the bridge approach in our
Application.
* We push the key-value pairs to print in logs as provided in the pattern
layout with the help of NDC and MDC.
* In log4j2 (bridge), this NDC internally uses ThreadContext to store the keys
and values.
* But it seems that there is some bug in the ThreadContext, as its stack keeps
increasing in size causing a high heap due to which the application starts
doing Full GC.
* And the application become slow.
* We push the logs in a queue and a single thread polls data from the queue
pushes data in NDC and MDC, logs data, pops dada from NDC MDC, and polls again
from the queue.
* It seems MDC is fine but NDC has some issues as the data in context stacks
(stored in ThreadContext used for NDC operations) keeps increasing but the
context map (stored in ThreadContext used for MDC operations) seems fine.
> High Heap | GC Issue | Log4j 2
> ------------------------------
>
> Key: LOG4J2-3661
> URL: https://issues.apache.org/jira/browse/LOG4J2-3661
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.17.2
> Reporter: Akshay Kumar
> Priority: Blocker
> Attachments: Screenshot 2023-05-11 at 9.21.55 PM.png, Screenshot
> 2023-05-11 at 9.22.43 PM.png, Screenshot 2023-05-12 at 12.28.22 AM.png
>
>
> * We have migrated from log4j 1 to log4j 2 using the bridge approach in our
> Application.
> ** This issue occurs even after migrating the application to log4j2.
> * We push the key-value pairs to print in logs as provided in the pattern
> layout with the help of NDC and MDC.
> * In log4j2 (bridge), this NDC internally uses ThreadContext to store the
> keys and values.
> * But it seems that there is some bug in the ThreadContext, as its stack
> keeps increasing in size causing a high heap due to which the application
> starts doing Full GC.
> * And the application becomes slow.
> * We push the logs in a queue and a single thread polls data from the queue
> pushes data in NDC and MDC, logs data, pops dada from NDC MDC, and polls
> again from the queue.
> * It seems MDC is fine but NDC has some issues as the data in context stacks
> (stored in ThreadContext used for NDC operations) keeps increasing but the
> context map (stored in ThreadContext used for MDC operations) seems fine.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)