Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Deadlock between WebAppClassLoader and Logback

Hi Marco,

Hmmm, nasty!  Unfortunately the page at http://jira.qos.ch/browse/LOGBACK-648 is down, so I can't see it. However, I have seen others reference it whilst googling around.

I notice that LogBack also has an unsynchronized version of the AppenderBase, possibly for just this situation: http://logback.qos.ch/xref/ch/qos/logback/core/UnsynchronizedAppenderBase.html as referred to here: http://logback.qos.ch/manual/appenders.html#AppenderBase.  Perhaps that will help you?

I have raised an issue to protect the LOG.debug statement in WebAppClassLoader: https://github.com/eclipse/jetty.project/issues/913, although from the stacktrace you provided, it is not that line that is causing the logging, but line 445, which *is* protected by an LOG.isDebugEnabled().

So, if I understand this correctly, this problem will only happen when you have DEBUG enabled on the WebAppClassLoader, correct?

Jan



On 9 September 2016 at 02:11, marco.signorini@xxxxxxxxx <marco.signorini@xxxxxxxxx> wrote:
Hi Jetty-Dev,

During tests of my application I experienced a deadlock between the Jetty WebAppClassLoader and the AppenderBase class of logback.

This issue has been reported to Logback on Jun 2009 (LOGBACK-648).

Unfortunately I didn't find any post related to this issue in the Jetty mailing lists; if I'm wrong, please give me a pointer to the discussion.



I attached the jstack dump of the two threads that block each other:
  1. One thread (ForkJoinPool-1-worker-1) is loading a class and for debug reasons WebAppClassLoader tries to log; 
  2. the second thread (ForkJoinPool-1-worker-2) tries to log a CometD outgoing message and in order to format the messsage, a new object is needed.
In this specific scenario I'm using Jetty 9.3.9.v20160517 but the issue is also replicable with Jetty 9.3.11.

Please note that the WebAppClassLoader#loadClass(String,boolean) has an unprotected LOG.debug statement.

Do you have any suggestion to avoid the deadlock?

Thanks,
Marco

--
Email sent by Signorini Marco.

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top