logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James A. N. Stauffer" <stauffer.ja...@gmail.com>
Subject Re: Log4j deadlock
Date Mon, 24 Sep 2007 16:59:18 GMT
I used to have additivity set to false for sps.webec.sql (I don't know
why it was changed).  Would that be sufficient to fix it?

On 9/24/07, Curt Arnold <carnold@apache.org> wrote:
>
> On Sep 24, 2007, at 8:59 AM, James A. N. Stauffer wrote:
>
> > Does this provide any clues?
>
> Yes, the problem is shown in the stack trace.
> sps.webec.sql.ConnectionBroker uses log4j internally and is also used
> to implement an log4j appender.  The problem comes that the order of
> obtaining locks is inconsistent.  In the first thread it is:
>
> synchronized(ConnectionBroker) {
>      synchronized(RootCategory) {
>           append message;
>      }
> }
>
> In the other thread it is:
>
> synchronized(RootCategory) {
>      start DB appending
>      synchronized(ConnectionBroker) {
>            finish DB appending;
>      }
> }
>
> The deadlock occurs when each thread gets its first lock, but can't
> get its second.
>
>
> > Do you have suggestions on what I should do?
> >
>
> If you are just using the sps.webec packages and have no ability to
> change the code, you could work around the problem by configuration
> changes so that the sps.webec.sql.ConnectionBroker logging requests
> aren't sent to a sps.webec.server.util.DBAppender (at least
> directly).  If you know the logger names used in that code, you could
> set the threshold to OFF, you could direct the logging requests to a
> different type of appender (console or file).  You could also wrap
> the sps.webec.server.util.DBAppender with an AsyncAppender with
> blocking = false.
>
> If you do have ability to change the code, then you could look at the
> possibility of moving the logging code in ConnectionBroker so that
> logging occurs after the ConnectionBroker lock is released.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message