Hi,

Sorry for disturbing the release process of LogKit :-).
But there is a possible 'deadlock' in doProcessEvent() of AsyncLogTarget.

When waiting in case of a full queue ...

(AsynLogTarget:131)

                final int size = m_list.size();
            while( m_queueSize <= size )
            {
                try
                {
                    m_list.wait();
                }
                catch( final InterruptedException ie )
                {
                    //This really should not occur ...
                    //Maybe we should log it though for
                    //now lets ignore it
                }
            }

... we do not recalculate the size. Therefore any thread waiting for the queue to get 
a free slot
will not recognize when an element is removed.

This means all threads of a system that are logging to that target might block here 
forever 
(if the consumer is to slow or the queue to small).

I would recommend to patch like this:

-               final int size = m_list.size();
+               int size = m_list.size();
            while( m_queueSize <= size )
            {
                try
                {
                    m_list.wait();
                }
                catch( final InterruptedException ie )
                {
                    //This really should not occur ...
                    //Maybe we should log it though for
                    //now lets ignore it
                }
+                size = m_list.size();
            }

(... or use the size() function directly for comparison).


Additionally I got an issue when restarting my system (including complete 
reestablishment of the log-system without closing the JVM) 
because the AsyncTargets are not closing the targets they are wrapping and when 
restarting opening a stream to 
an underlying file-target will not get the required write-access.
I somehow hacked it like this (close() cannot be called from the interface LogTarget):

(AsynLogTarget:192)

                          else if( interupted || Thread.interrupted() )
                    {
                        //ie there is nothing in queue and thread is interrupted
                        //thus we stop thread

+                        try
+                        {
+                            if ( m_logTarget instanceof AbstractTarget )
+                            {
+                                ((AbstractTarget)m_logTarget).close();
+                            }
+                        }
+                        catch( final Throwable throwable )
+                        {
+                            getErrorHandler().error( "Unknown error closing target.", 
+throwable, event );
+                        }

                        return;
                    }


Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to