You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Timothy Stack (JIRA)" <ji...@apache.org> on 2014/07/23 21:41:40 UTC

[jira] [Created] (LOG4J2-738) RollingFileManager deadlock if async action thread fails to start

Timothy Stack created LOG4J2-738:
------------------------------------

             Summary: RollingFileManager deadlock if async action thread fails to start
                 Key: LOG4J2-738
                 URL: https://issues.apache.org/jira/browse/LOG4J2-738
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0-rc1
         Environment: amazon linux
            Reporter: Timothy Stack


The symptom we're seeing is a thread stuck trying to acquire the semaphore in RollingFileManager.rollover().  It looks like the RollingFileManager can fail to release the semaphore if there is an exception during thread start for the async path in the rollover() method.

I think this is the relevant chunk of code:

                if (success && descriptor.getAsynchronous() != null) {
                    LOGGER.debug("RollingFileManager executing async {}", descriptor.getAsynchronous());
                    thread = new Thread(new AsyncAction(descriptor.getAsynchronous(), this));
                    thread.start();
                }
                return true;
            }
            return false;
        } finally {
            if (thread == null) {
                semaphore.release();
            }
        }

So, if thread start fails (because of OOM), the 'thread' variable will be != null and so the semaphore won't be released.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org