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..."