Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-148

ThreadContext uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic] variables.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.9, 1.2.10
    • Fix Version/s: 1.2.12
    • Component/s: Core
    • Labels:
      None
    • Environment:
      .Net Framework

      Description

      According to this article (http://blogs.msdn.com/junfeng/archive/2005/12/31/508423.aspx) and production issues encountered: using LocalDataStore is not a scalable approach for any web server that gets a significant amount of traffic.

      The ThreadContext object should be modified to use [ThreadStatic] variables.

      From the article:
      The Whidbey RTM implementation of Thread.GetData/Thread.SetData has several scalability issues caused by global locks being taken. The appdomain-global lock taken in LocalDataStore.SetData is one of them. There is another global lock taken in ThreadNative::GetDomainLocalStore that is even worse since it is process-global.

      The best workaround is to use [ThreadStatic] variables instead of Thread.GetData/Thread.SetData

        Attachments

          Activity

            People

            • Assignee:
              nachbarslumpi Dominik Psenner
              Reporter:
              htorresrocca Hernando Torres-Rocca
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: