You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Dzmitry Anikechanka (Jira)" <ji...@apache.org> on 2019/11/18 08:37:00 UTC

[jira] [Created] (LOG4J2-2725) RingBufferLogEvent.clear() is not called in case of OutOfMemoryError (or any other exception/error)

Dzmitry Anikechanka created LOG4J2-2725:
-------------------------------------------

             Summary: RingBufferLogEvent.clear() is not called in case of OutOfMemoryError (or any other exception/error)
                 Key: LOG4J2-2725
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2725
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.12.1
            Reporter: Dzmitry Anikechanka
         Attachments: RingBufferLogEvent_OOM.log, RingBufferLogEvent_dominator_tree.txt

Please see the following class [https://logging.apache.org/log4j/2.x/log4j-core/apidocs/src-html/org/apache/logging/log4j/core/async/RingBufferLogEventHandler.html]

There is the following code in the onEvent() method:
{code:java}
event.execute(endOfBatch);
event.clear();{code}
But in case of an exception (or error) in the execute() method - method clear() will not be invoked, event will be not cleared (and logged message as well) and will be in the memory (probably try/catch will be enough to fix the issue).

I've faced this issue when OutOfMemoryError occurred due to very large messages logging (also message is duplication in the SimpleMessage class, please see related issue https://issues.apache.org/jira/browse/LOG4J2-2724) - all these event are still in memory and it causes a lot of another OOM errors as memory is not released (because clear() method was not invoked).

Could you please fix it or explain if such behavior is expected?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)