Re: Program hangs when terminating on v14.1

Carter Kozak <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <[email protected]>
I believe I fixed this on the 2.x branch and master a few months ago, it should be available in our 2.15 release (likely in the next month). I don’t have the ticket link available from my phone, I can link it later in the day when I have a moment.

-ck

> On Aug 3, 2021, at 2:03 AM, Laurent Hasson <[email protected]> wrote:
> 
> I may have found it...
> 
> Thread [Log4j2-AsyncAppenderEventDispatcher-1-ASYNC] (Running)    
> 
> 
> Laurent Hasson
> Co-Founder and CTO
> CapsicoHealth Inc.
> 
> 
> 
> -----Original Message-----
> From: Laurent Hasson <[email protected]> 
> Sent: Tuesday, August 3, 2021 02:01
> To: Log4J Users List <[email protected]>
> Subject: RE: Program hangs when terminating on v14.1
> 
> I am not sure how to do this. I am on Eclipse?
> 
> 
> Laurent Hasson
> 
> 
> -----Original Message-----
> From: Volkan Yazıcı <[email protected]>
> Sent: Tuesday, August 3, 2021 01:59
> To: Log4J Users List <[email protected]>
> Subject: Re: Program hangs when terminating on v14.1
> 
> Hello Laurent,
> 
> Thanks for the report and the reproduction path. Would you be able to hook up a profiler and figure out the thread blocking the exit, please?
> 
> Kind regards.
> 
>> On Tue, Aug 3, 2021 at 7:54 AM Laurent Hasson <[email protected]> wrote:
>> 
>> Hello,
>> 
>> We use Log4J2 as our logging library both in a Web environment (under 
>> Tomcat), and in command-line utilities. I have noticed recently that 
>> our command-line utilities seem to hang when done: the normal JVM's 
>> exit is blocked.
>> 
>> I am on JDK 15 with log4j-web-2.14.1.jar, log4j-core-2.14.1.jar and 
>> log4j-api-2.14.1.jar in the classpath.
>> 
>> My configuration is:
>> <?xml version="1.0" encoding="UTF-8"?> <Configuration status="info">
>>       <Properties>
>>              <Property
>> name="log-path">C:\Projects\TomcatDevServer\logs\</Property>
>>              <Property name="now">${date:yyyy-MM-dd}</Property>
>>       </Properties>
>>       <Appenders>
>>              <RollingFile name="FILES" fileName="${log-path}/capsico.log"
>> filePattern="${log-path}/capsico.${now}.%i.log.gz">
>>                     <PatternLayout>
>>                <pattern>%d{MMdd.HHmmss.SSS}#%-3t %level{length=1} 
>> %15.15c{1}| %m %ex{50}%n</pattern>
>>                     </PatternLayout>
>>                     <Policies>
>>                           <SizeBasedTriggeringPolicy size="100 MB" />
>>                     </Policies>
>>                     <DefaultRolloverStrategy max="99999"
>> compressionLevel="6"/>
>>              </RollingFile>
>>              <Async name="ASYNC">
>>                     <AppenderRef ref="FILES" />
>>              </Async>
>>              <Console name="Console" target="SYSTEM_OUT">
>>                     <PatternLayout>
>>                 <pattern>%d{MMdd.HHmmss.SSS}#%-3t %level{length=1} 
>> %15.15c{1}| %m %ex{50}%n</pattern>
>>                     </PatternLayout>
>>        </Console>
>>       </Appenders>
>>       <Loggers>
>>              <Root level="debug">
>>            <AppenderRef ref="Console" />
>> <!--
>>            <AppenderRef ref="ASYNC" />
>>            <AppenderRef ref="Console" />
>> -->
>>              </Root>
>>       </Loggers>
>> </Configuration>
>> 
>> We switch between console when developing to async in production, thus 
>> the two options.
>> 
>> My test program is super simple:
>> import org.apache.logging.log4j.LogManager;
>> import org.apache.logging.log4j.Logger;
>> 
>> public class Test
>>  {
>>    protected static final Logger LOG = 
>> LogManager.getLogger(Test.class.getName());
>> 
>>    public static void main(String[] args)
>>      {
>>         LOG.debug("Hello");
>>      }
>>  }
>> 
>> This program hangs and doesn't exit. If I replace the Log4J2 JARs with 
>> v12.1, all works as expected. I checked JDK 8 and JDK 11 with the same 
>> behavior.
>> 
>> If I remove the <Async> element, it works, pointing to that capability 
>> causing issues. My guess is that a thread is not getting closed and 
>> hangs the JVM's normal exist.
>> 
>> I did not see a reference to some API changes from v12 to v14 that 
>> would explain this, or maybe I missed something? Or maybe it's a bug?
>> 
>> Thank you,
>> Laurent Hasson
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> ТÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÐÐ¥FòVç7V'67&–&RÂRÖÖ–âÆösF¢×W6W"×Vç7V'67&–&TÆövv–æræ6†Ræ÷&pФf÷"FF—F–öæÂ6öÖÖæG2ÂRÖÖ–âÆösF¢×W6W"Ö†VÇÆövv–æræ6†Ræ÷&pÐ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.