At 10:04 AM 12/18/2003 -0800, Elias Ross wrote:
On Thu, 2003-12-18 at 07:56, Ceki Gülcü wrote:
> >class State { > > Logger log; > > > > synchronized void setState() { > > // Something takes a long time here > > log.debug("hello world"); > > } > > > > synchronized Object getState() { > > } > > > > public String toString() { > > return "state=" + getState(); > > } > >} > > The above scenario is quite special. It is yet unclear if the deadlock > observed by Prithi is related.
Well, that's the sort of scenario that I have run into, under load while having debugging on. I have run into it under JBoss with the JBoss classloader. I have run into it in a open source library. If you are doing any sort of multi-threaded programming with logging under multiple threads, I have been able to reproduce this deadlock every time.
Hello Elias,
Unless I am mistaken this bug was acknowledged and diagnosed within 48 hours after being reported. The deadlock is caused by the invocation of a synchronized method from within the toString() method of an object used as the message payload of a logging request. It is independent of the run-time environment. It is independent of the classloader scheme, servlet container or EJB container.
The deadlock will not occur if the message payload of a logging request is a String. No deadlock will occur if the toString of the message payload object does not invoke a synchronized method. All I am saying is that the deadlock is not universal. It occurs under special circumstances which are well identified. Not all deadlock problems are instances of the bug you describe. Nevertheless, i do not mean to insinuate that it is unimportant.
If you don't plan to fix this issue, you should at least make a note about the problem.
Fully agreed.
Here's a program which will reproduce the deadlock. There is nothing special about this program:
It illustrates the bug quite well. Thank you for writing it. However, the bug you mention may not be related to Prithi's problem. We should perhaps try to focus on his problem.
-- Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]