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 bu...@apache.org on 2007/06/05 14:08:10 UTC

DO NOT REPLY [Bug 42585] New: - SocketNode can leak Sockets

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42585>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42585

           Summary: SocketNode can leak Sockets
           Product: Log4j
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: odi@odi.ch


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)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42585] - SocketNode can leak Sockets

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42585>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42585





------- Additional Comments From odi@odi.ch  2007-06-05 06:32 -------
Created an attachment (id=20312)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20312&action=view)
patch


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42585] - SocketNode can leak Sockets

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42585>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42585





------- Additional Comments From odi@odi.ch  2007-06-06 00:38 -------
Fantastic, thanks a lot.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42585] - SocketNode can leak Sockets

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42585>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42585


carnold@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From carnold@apache.org  2007-06-05 16:28 -------
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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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