Return-Path: X-Original-To: apmail-logging-log4net-dev-archive@www.apache.org Delivered-To: apmail-logging-log4net-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9ED3E109ED for ; Thu, 31 Oct 2013 12:34:24 +0000 (UTC) Received: (qmail 78995 invoked by uid 500); 31 Oct 2013 12:34:24 -0000 Delivered-To: apmail-logging-log4net-dev-archive@logging.apache.org Received: (qmail 78951 invoked by uid 500); 31 Oct 2013 12:34:19 -0000 Mailing-List: contact log4net-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET Dev" List-Id: Delivered-To: mailing list log4net-dev@logging.apache.org Received: (qmail 78940 invoked by uid 99); 31 Oct 2013 12:34:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Oct 2013 12:34:17 +0000 Date: Thu, 31 Oct 2013 12:34:16 +0000 (UTC) From: "Dominik Psenner (JIRA)" To: log4net-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4NET-403) LocalDataStoreSlot exception when using log4net in Dispose method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4NET-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13810193#comment-13810193 ] Dominik Psenner commented on LOG4NET-403: ----------------------------------------- The loggers should be static attributes or properties, otherwise they might get finalized by the GC when their reference counter is 0 (i.e. the containing object is finalized). Further, if these attributes or properties are not static the application may suffer of a severe performance penalty for every instantiation. Please close and mark the issue as invalid if making the attribute/property static solves your problems. > LocalDataStoreSlot exception when using log4net in Dispose method > ----------------------------------------------------------------- > > Key: LOG4NET-403 > URL: https://issues.apache.org/jira/browse/LOG4NET-403 > Project: Log4net > Issue Type: Bug > Components: Core > Affects Versions: 1.2.11 > Environment: Windows 7 64 bit, .Net Framework 4.5 > Reporter: PiotrG > Priority: Critical > > Setting ThreadContext property in Dispose method called by GC thread throws Exception: > LocalDataStoreSlot storage has been freed > Stacktrace: > w System.LocalDataStore.GetData(LocalDataStoreSlot slot) > w System.Threading.Thread.GetData(LocalDataStoreSlot slot) > w log4net.Util.ThreadContextProperties.GetProperties(Boolean create) > w log4net.Util.ThreadContextProperties.set_Item(String key, Object value) > w xxx.Dispose(Boolean freeAlsoManagedObjects) > w xxx.Finalize() > Code: > private void Dispose(bool freeAlsoManagedObjects) > { > > if (_log.IsErrorEnabled) > ThreadContext.Properties["method"] = "Dispose"; // throws Exception > -- This message was sent by Atlassian JIRA (v6.1#6144)