logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Louis Jacomet <ljaco...@gmail.com>
Subject Re: Race condition in AsyncAppender
Date Fri, 10 Dec 2010 15:36:22 GMT
Follow up on the issue mentionned.

You will find attached the smallest change that fixes the issue and should
not change any current AsyncAppender behavior.

Regards,
Louis

On Fri, Dec 10, 2010 at 10:11 AM, Louis Jacomet <ljacomet@gmail.com> wrote:

> Hi all,
>
> I recently investigated a deadlock happening inside our JBoss AS.
> I tracked down the root cause to the AsyncAppender of log4j.
> We use it in blocking mode, with the default buffer size of 128. I was able
> to reproduce the deadlock live even when increasing the buffer size to 512.
>
> The problem comes from a race condition when the dispatcher thread dies
> from an exception. When that happens, if the buffer has been filled up by
> other threads doing logging, the thread currently waiting on the buffer to
> be emptied will never be notified and wait there forever.
> As a category lock is held to access the appender, this lead other threads
> to block forever.
>
> I found a bug in the database:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=45915
> However, the root cause was associated to logging from the Dispatcher
> thread. I have attached a test cause causing the deadlock, showing it can
> occur even when not logging from the dispatcher thread.
>
> Should I reopen that bug or create a new one?
>
> We are using log4j 1.2.14 and JBoss AS 4.3.0.
> The latest trunk version of AsyncAppender still suffers from the race
> condition.
>
> Regards,
> Louis
>

Mime
View raw message