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 Jan,

Yes, the problem happens only at debug level. However all log traces needs to be guarded as fixed in #913

Using the Unsynchronized appender fixes the issue.

Regarding the log statements inside the WebAppClassLoader#loadClass, is it possible to trace input parameters and debug ones outside the synchronized block?

Marco


2016-09-09 10:16 GMT+02:00 Jan Bartel <janb@xxxxxxxxxxx>:
Michele,

I think you'd be surprised ... whenever there's classloading issues it is useful to turn on debug logging to see it. I don't think its unreasonable that the WebAppClassloader does some logging (particularly if its only when debug is enabled!).

Jan

On 9 September 2016 at 17:55, Michele Rossi <michele.rossi@xxxxxxxxx> wrote:
hi guys,

could we also consider the possibility of removing those logging statements from the WebAppClassLoader?

After all it's a very low-level and critical piece of code, if logging has a potential to create these problems why take the risk?

I doubt many people will miss seeing those logging statements..


thanks,
Michele





On 9 September 2016 at 02:03, Jan Bartel <janb@xxxxxxxxxxx> wrote:
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


_______________________________________________
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


_______________________________________________
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


_______________________________________________
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



--
Email sent by Signorini Marco.

Back to the top