[logback-dev] [JIRA] (LOGBACK-1358) why AsyncAppender worker thread don't catch the error and Exception

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Dec 4 13:12:00 CET 2017


xiezhaoodong created LOGBACK-1358:
-------------------------------------

             Summary: why AsyncAppender worker thread don't catch the error and Exception
                 Key: LOGBACK-1358
                 URL: https://jira.qos.ch/browse/LOGBACK-1358
             Project: logback
          Issue Type: Bug
          Components: logback-core
    Affects Versions: 1.2.3
         Environment: linux X86_64

LOGBACK VERSION :

!image-2017-12-04-20-11-40-721.png!
            Reporter: xiezhaoodong
            Assignee: Logback dev list
         Attachments: image-2017-12-04-20-09-02-754.png, image-2017-12-04-20-11-40-721.png

{code:java}
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();
    }
}

{code}
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:

!image-2017-12-04-20-09-02-754.png!

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

 

 

 



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list