[ https://issues.apache.org/jira/browse/LOG4J2-3505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536886#comment-17536886 ]
Maksim Fedorov commented on LOG4J2-3505: ---------------------------------------- {code:java} @Override public EventRoute getRoute(long backgroundThreadId, Level level) { DISCARD_COUNT.incrementAndGet(); // AtomicLong return EventRoute.DISCARD; } {code} I guess multiple contexts aren't really a thing that we intended to have, so we can definitely try switching to {{BasicAsyncLoggerContextSelector}}. May this be the cause of our issue? > Threads get stuck inside TimeoutBlockingWaitStrategy when using async logging > ----------------------------------------------------------------------------- > > Key: LOG4J2-3505 > URL: https://issues.apache.org/jira/browse/LOG4J2-3505 > Project: Log4j 2 > Issue Type: Bug > Components: Appenders > Affects Versions: 2.17.1 > Reporter: Maksim Fedorov > Priority: Major > Attachments: threads.txt > > > In our project we are using log4j2 2.17.1 in async mode with > RollingRandomAccessFile appenders, LMAX Disruptor version is 3.4.4. Sometimes > our application gets in a situation when some of its threads get stuck > infinitely inside Disruptor's > {{TimeoutBlockingWaitStrategy#signalAllWhenBlocking}} method, while log4j2 > async logger threads are sitting in {{TimeoutBlockingWaitStrategy#waitFor}} > (see the attached excerpt from the thread dump). From this point logging > stops completely and the abovementioned application threads become unable to > make any progress. We added a custom async log queue policy which discards > all messages regardless of the log level in case of an overflow, but it > didn't help. Here is our logging configuration: > {noformat} > -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector > -Dlog4j2.asyncLoggerRingBufferSize=524288 > -Dlog4j2.asyncQueueFullPolicy=com.mycompany.logging.DiscardingLogQueueFullPolicy > {noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007)