[logback-dev] [JIRA] (LOGBACK-1382) AsyncAppender#putUninterruptibly looks suspicious

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Feb 15 09:35:00 CET 2018

Gérald Quintana created LOGBACK-1382:

             Summary: AsyncAppender#putUninterruptibly looks suspicious
                 Key: LOGBACK-1382
                 URL: https://jira.qos.ch/browse/LOGBACK-1382
             Project: logback
          Issue Type: Task
          Components: logback-core
    Affects Versions: 1.2.3
         Environment: The code in AsyncAppenderBase#putUninterruptibly is suspicious, if InterruptedException is raised in blockingQueue.put(...), the interrupted flag is set to true but as there is a while(true) around the current Thread will not be interrupted and the code in the finally block may never occur.

private void putUninterruptibly(E eventObject) {
    boolean interrupted = false;
    try {
        while (true) {
            try {
            } catch (InterruptedException e) {
                interrupted = true;
    } finally {
        if (interrupted) {
What's the purpose of this infinite loop?

I suspect the intent was to write while(!interrupted&&!pushed) instead of while(true).

To me, the blockingQueue.put is a blocking operation, the current thread will wait until it can push the event in the queue. Attempting multiple retries seems useless and dangerous to me.


            Reporter: Gérald Quintana
            Assignee: Logback dev list

This message was sent by Atlassian JIRA

More information about the logback-dev mailing list