[ 
https://issues.apache.org/jira/browse/LOG4J2-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory resolved LOG4J2-738.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.1

{noformat}
commit -m "[LOG4J2-738] RollingFileManager deadlock if async action thread 
fails to start." 
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
 C:/vcs/svn/apache/log4j2/trunk-alt/src/changes/changes.xml
    Sending        
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
    Sending        C:/vcs/svn/apache/log4j2/trunk-alt/src/changes/changes.xml
    Transmitting file data ...
    Committed revision 1613171.
{noformat}

Please verify, comment, and resolve or close as appropriate.

Thank you!
Gary

> 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
>             Fix For: 2.0.1
>
>
> 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:
> {code:java}
>                 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();
>             }
>         }
> {code}
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to