You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Joe (JIRA)" <ji...@apache.org> on 2016/11/02 18:50:00 UTC

[jira] [Created] (LOG4NET-529) Possible thread-safety bug in LoggingEvent

Joe created LOG4NET-529:
---------------------------

             Summary: Possible thread-safety bug in LoggingEvent
                 Key: LOG4NET-529
                 URL: https://issues.apache.org/jira/browse/LOG4NET-529
             Project: Log4net
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.15
            Reporter: Joe
            Priority: Minor


From imspecting the code there appears to be a race condition if two threads call LoggingEvent.LookupProperty concurrently.  One thread may call CreateCompositeProperties and the other might access m_compositeProperties before it is fully created.

             public object LookupProperty(string key)
             {
                    if (m_data.Properties != null)
                    {
                           return m_data.Properties[key];
                    }
                    if (m_compositeProperties == null)
                    {
                           CreateCompositeProperties();
                    }
                    return m_compositeProperties[key];
             }
 
             private void CreateCompositeProperties()
             {
                    m_compositeProperties = new CompositeProperties();
 
                    if (m_eventProperties != null)
                    {
                           m_compositeProperties.Add(m_eventProperties);
                    }
                    ... etc




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)