Re: Deadlock Reggie - Java logging and net.jini.jeri.ssl.SslServerEndpointImpl

Mark Brouwer <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Gregg Wonderly wrote:
> Ramiro Voicu wrote:
>> Hello,
>>
>>  The stack trace can be found at this URL:
>>
>> http://monalisa.cern.ch/~ramiro/Jini/reggie.log.SAVE_21Jun
>>
>>
>>  The LUS was using Jini 2.0.1, but I think Jini2.1 has the same problem.
>> The deadlock appears only if the logging level for SslServerEndpointImpl
>> is at least Level.FINE. The JVM used is the latest: 1.6.0_01 (i586) on
>> Linux (if more OS specific details will help please let me know).
>
> As a followup to this, this is a really interesting problem with the
> java.util.logging implementation, trying to lock the logger to do
> formatting.
> The formatting should be done without a lock asserted.  I reported this
> as bug
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4939307
>
> It was closed, will not fix.  I don't think the reviewer understood the
> real
> issue, and I didn't do a great job of explaining the who issue, assuming
> too
> much would be obvious I suppose.

You are right Gregg, deadlocks triggered by the logging framework have
been on the number one position for Seven for a long time. The good
thing though is that most of the times it only occurs during
troubleshooting and we haven't seen them in production.

As a rule of thumb I always try to move logging out of synchronized
blocks (also for performance reasons), sometimes by building messages as
part of the synchronized block and the actual logging outside that block.

I also wondered why the synchronization is as it is, but if you look at
all classes you will see that most methods related to configured levels,
filters, etc are synchronized so from that perspective I understand why
the publish method has been completely synchronized.

But there is no denial that synchronization could have been done better
and at least they could have documented their synchronization strategy.
--
Mark

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.