Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1358

why AsyncAppender worker thread don't catch the error and Exception

    Details

    • Type: Bug
    • Status: Open
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: logback-core
    • Environment:

      linux X86_64

      LOGBACK VERSION :

      Description

      class Worker extends Thread {
      
          public void run() {
              AsyncAppenderBase<E> parent = AsyncAppenderBase.this;
              AppenderAttachableImpl<E> aai = parent.aai;
      
              
              while (parent.isStarted()) {
                  try {
                      E e = parent.blockingQueue.take();
                      aai.appendLoopOnAppenders(e);
                  } catch (InterruptedException ie) {
                      break;
                  }
              }
      
              addInfo("Worker thread will flush remaining events before exiting. ");
      
              for (E e : parent.blockingQueue) {
                  aai.appendLoopOnAppenders(e);
                  parent.blockingQueue.remove(e);
              }
      
              aai.detachAndStopAllAppenders();
          }
      }
      
      

      There is a worker object in the object AsyncAppenderBase。

       

      if run() method don't catch the exception and error,when OutOfMemory occurs。this thread will dead

      like this:

      OOM make the appender-worker  dead

      when the blockingQueue(use ArrayBlockingQueue) is full,the "put" thead will hang forever!!!!

       

      First of all, thank you for answering my doubts

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              logback-dev Logback dev list
              Reporter:
              xiezhaodong xiezhaoodong
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: