Bug 46324

Summary: SocketNode does not close socket when ending
Product: Log4j - Now in Jira Reporter: Jon Osborn <jon>
Component: AppenderAssignee: log4j-dev <log4j-dev>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: P2    
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Jon Osborn 2008-12-02 10:02:11 UTC
In org.apache.log4j.net.SocketNode, the code does not close the socket when the objectinputstream has an error.

This block attempts to close the objectinputstream:

    try {
      ois.close();
    } catch(Exception e) {
      logger.info("Could not close connection.", e);
    }

if the objectinputstream is null, however, socket.close() is never called thus leaking a socket.

Pls add

    try {
      socket.close();
    } catch(Exception e) {
      logger.info("Could not close socket.", e);
    }


to the end of run() in org.apache.log4j.net.SocketNode
Comment 1 Curt Arnold 2009-01-08 09:34:51 UTC

*** This bug has been marked as a duplicate of bug 42585 ***