Hello.

I've been a happy user of log4j for years- only recently have I been prompted 
to look at the source code as after running our software under a load test for 
about a day, I see all logging threads come to an abrupt halt.

I'm still gathering info on the problem, but I think I figured out what's going 
on in a general sense and thought I'd mention here what I know so far.  I'm 
using 1.2.15.

Quite simply, my AsyncAppender.Dispatcher thread is throwing an uncaught 
exception.  My (j2ee/jboss) application is configured to log uncaught 
exceptions, and attempting to log from the Dispatcher thread in this state not 
surprisingly causes a deadlock - while the DispatcherThread is trying to 
acquire a lock on the RootLogger, the thread owning it is waiting on 
AsyncAppender's buffer lock, which I think is owned by the Dispatcher.

I've instrumented the code a bit and the next time I can reproduce this I 
should find out what exception AsyncAppender.Dispatcher is encountering, but 
regardless I expect it should be getting caught, especially on a system 
configured to log uncaught exceptions.  Right now I'm simply catching 
throwable, System.out'ing about it, and then exiting the Dispatcher thread, 
which will just make all future logging synchronous.

If anyone with more experience in the code has a better idea on how to react to 
exceptions encountered in the Dispatcher thread, I'd love to hear them.  Of 
course, once I know what exception is happening I'll try to address it as well, 
but I also need all possible safeguards in place against my system grinding to 
a halt because of it.

Marc

Reply via email to