Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-461

SocketAppender creates memory issue for log4j server.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0, 0.11.0
    • Fix Version/s: 0.11.0
    • Component/s: Appender
    • Labels:
      None
    • Environment:
      Red Hat Linux 6.7

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              tschoening Thorsten Schöning
              Reporter:
              JeremyGibson Jeremy Gibson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: