[ 
https://issues.apache.org/jira/browse/LOG4J2-2106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16246928#comment-16246928
 ] 

skopt commented on LOG4J2-2106:
-------------------------------

   Reading the code, I find the cause. In the function rollover of class 
RollingFileManager, it will block until all the asynchronous operation is 
completed. Because the log is very large, the compression triggered by 
OnStartupTriggeringPolicy will cost several minutes.  So the rollover() 
function will keep the synchronized lock for a long time when processing 
rollover triggered by TimeBasedTriggeringPolicy.  At that time, the write 
function will be blocked for waiting the same synchronized lock.
   As it will block the application,  should the rollover be parallel 
processed? The file will create a temp file fro compress and the synchronized 
lock for the rollover would ensure that a file will not rename at the same 
time. Is the semaphore still necessary?

Thanks.

> May blocked when two compress action
> ------------------------------------
>
>                 Key: LOG4J2-2106
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2106
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.9.1
>            Reporter: skopt
>
>      My log file is very large, so I set the config about compression. The 
> policies is as follows:
>      <Policies>
>            <OnStartupTriggeringPolicy/>
>            <TimeBasedTriggeringPolicy/>
>      </Policies>
>      When restart the service on the hour,  this will trigger the two 
> policies. And I find that the log can not be written for a while. 
>      I think, there would be two compress actions. In the file 
> RollingFileManager(package org.apache.logging.log4j.core.appender.rolling), 
> the actions will submit to asyncExecutor which will create a new thread for 
> every work. That mean the log file will be compressed by the two actions. Is 
> this the cause?
>  Thanks.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to