You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/09/04 05:56:20 UTC

[jira] [Closed] (LOG4J2-1562) SocketAppender memory usage grows unbounded if it cannot connect to a server

     [ https://issues.apache.org/jira/browse/LOG4J2-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory closed LOG4J2-1562.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 2.7

In Git master.

> SocketAppender memory usage grows unbounded if it cannot connect to a server
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-1562
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1562
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.6.2
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 2.7
>
>
> SocketAppender memoey usage grows unbounded if it cannot connect to a server.
> The socket appender uses a ByteArrayOutputStream as its data sink if a socket cannot be opened to the server. The appender then tries to reconnect to this server and then overwrites the output stream. The data in the ByteArrayOutputStream is lost. The problem is that if the server is never there, the ByteArrayOutputStream will keep on accumulating log events until the JVM runs out of memory.
> The proposed solution is to replace using a ByteArrayOutputStream with a NullOutputStream.
> As Remko remarks on the dev ML: "Actually supporting message buffering until reconnect properly is not going to be trivial. (Wouldn't a spool file be better than a memory buffer? Bounded or unbounded? What to do if we discover an unsent spool file at startup? How do we handle disconnects while sending events from the spool file? What about log4j shutdown while sending a large spool file? Or process crashes?) We're entering Kafka-like territory here..."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org