Jeremy Gibson created LOGCXX-461:
------------------------------------
Summary: SocketAppender creates memory issue for log4j server.
Key: LOGCXX-461
URL: https://issues.apache.org/jira/browse/LOGCXX-461
Project: Log4cxx
Issue Type: Bug
Components: Appender
Affects Versions: 0.10.0, 0.11.0
Environment: Red Hat Linux 6.7
Reporter: Jeremy Gibson
log4cxx is reproducing java's serialization methods in the ObjectOutputStream
class which the SocketAppender uses. However, there is one part missing. The
Java implementation of SocketAppender does a reset of the ObjectOutputStream
after each event which tells the ObjectInputStream to clean up its references
on the server side. Without this reset, the references will never clean up and
the server will run out of memory. There are no good ways to fix this from the
java side since the ObjectInputStream is depending on the ObjectOutputStream to
do the resetting. The byte code for TC_RESET is 0x79. So a reset function might
look something like this in ObjectOutputStream:
void ObjectOutputStream::reset(Pool& p){
os->flush(p);
writeByte(TC_RESET,p);
os->flush(p);
objectHandle = 0x7E0000;
classDescriptions->clear();
}
Not sure if the this change would influence any other parts of the code except
for a call in SocketAppender::append() function to use the after the
event->write() call.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)