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
*** This bug has been marked as a duplicate of bug 42585 ***