[
https://issues.apache.org/jira/browse/LOG4J2-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Failled updated LOG4J2-2388:
----------------------------
Description:
Logging a message to the Flume appender in an interrupted thread undefinetly
block the thread.
The thread is blocked in an unfinite loop here :
org.apache.logging.log4j.flume.appender.FlumePersistentManager.*send*(Event) :
{code:java}
boolean interrupted = false;
int ieCount = 0;
do {
try {
future.get();
} catch (final InterruptedException ie) {
interrupted = true;
++ieCount;
}
} while (interrupted && ieCount <= 1);
{code}
This test case allow to reproduce the problem (add the code below in
FlumePersistentAppenderTest):
{code:java}
@Test
public void testLogInterrupted() {
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> {
executor.shutdownNow();
final Logger logger = LogManager.getLogger("EventLogger");
final Marker marker = MarkerManager.getMarker("EVENT");
logger.info(marker, "This is a test message");
Assert.assertTrue("Interruption status not preserved",
Thread.currentThread().isInterrupted());
});
}
{code}
was:
Logging a message to the Flume appender in an interrupted thread undefinetly
block the thread.
The thread is blocked in an unfinite loop here :
org.apache.logging.log4j.flume.appender.FlumePersistentManager.*send*(Event) :
{code:java}
boolean interrupted = false;
int ieCount = 0;
do {
try {
future.get();
} catch (final InterruptedException ie) {
interrupted = true;
++ieCount;
}
} while (interrupted && ieCount <= 1);
{code}
> Thread undefinetly blocked when logging a message in an interrupted thread
> --------------------------------------------------------------------------
>
> Key: LOG4J2-2388
> URL: https://issues.apache.org/jira/browse/LOG4J2-2388
> Project: Log4j 2
> Issue Type: Bug
> Components: Flume Appender
> Reporter: Failled
> Priority: Critical
>
> Logging a message to the Flume appender in an interrupted thread undefinetly
> block the thread.
> The thread is blocked in an unfinite loop here :
> org.apache.logging.log4j.flume.appender.FlumePersistentManager.*send*(Event) :
>
> {code:java}
> boolean interrupted = false;
> int ieCount = 0;
> do {
> try {
> future.get();
> } catch (final InterruptedException ie) {
> interrupted = true;
> ++ieCount;
> }
> } while (interrupted && ieCount <= 1);
> {code}
>
> This test case allow to reproduce the problem (add the code below in
> FlumePersistentAppenderTest):
> {code:java}
> @Test
> public void testLogInterrupted() {
> ExecutorService executor = Executors.newSingleThreadExecutor();
> executor.execute(() -> {
> executor.shutdownNow();
> final Logger logger = LogManager.getLogger("EventLogger");
> final Marker marker = MarkerManager.getMarker("EVENT");
> logger.info(marker, "This is a test message");
> Assert.assertTrue("Interruption status not preserved",
> Thread.currentThread().isInterrupted());
> });
> }
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)