We had an issue when the SocketNode thread died with an OOM exception. The socket is not closed in this case. The sending SocketAppender doesn't notice and blocks indefinitely in SocketOutputStream.write. Due to the locks held on the appender this causes the whole application to block. One solution should be to close the the socket in a finally block. Of course we are also adding size checks to the problematic log statement plus increasing the heap size of the logserver. "Dispatcher-Thread-3" daemon prio=1 tid=0x5b6b6120 nid=0x6c8e runnable [0x5b16f000..0x5b16f770] at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1682) at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1591) at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1173) at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1127) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302) at org.apache.log4j.net.SocketAppender.append(SocketAppender.java:224) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221) - locked <0x66a9c690> (a org.apache.log4j.net.SocketAppender) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57) at org.apache.log4j.Dispatcher.run(AsyncAppender.java:310) - locked <0x66a9a060> (a org.apache.log4j.helpers.AppenderAttachableImpl)
Created attachment 20312 [details] patch
Fixed in rev 544675. Should make it into log4j 1.2.15. run method didn't check if ois or socket was null before doing actions on them so I added checks in addition to your suggested changes.
Fantastic, thanks a lot.
*** Bug 46324 has been marked as a duplicate of this bug. ***