[concurrency-interest] deadlock in java.util.logging

Gregg Wonderly gregg at cytetech.com
Mon Sep 25 21:35:05 EDT 2006

David Holmes wrote:
> I'm not sure if the StreamHandler can rely on its OutputStream correctly
> synchronizing writes so that messages are written atomically. However, even
> if it can't I think it should be able to do the formatter related actions
> outside of the synchronized block. That would prevent the cycle that causes
> the deadlock here. eg something like:

I've coded such a solution as you suggest to see if anything else falls out.

> That said, the classloader isn't blameless here as it performs logging while
> holding its own lock, thus violating the open-call principle. :)

Yes, that is perhaps the bigger problem.  It's my fault that it is logging with 
a lock held.  There are moments when that is unavoidable given some of the 
execution paths that expose classloading operations.  I will remove some of the 
debugging in that ClassLoader, or at least try and reduce some of the exposures.

But, I think this reveals an interesting path of circular dependencies involving 
unanticipated class loading operations.

Thanks for your views on this David!  I think I will file an enhancement request 
to at least get the call into the formating to not be synchronized.

Gregg Wonderly

More information about the Concurrency-interest mailing list