Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 40406 invoked from network); 5 Dec 2008 13:48:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2008 13:48:03 -0000 Received: (qmail 97797 invoked by uid 500); 5 Dec 2008 13:48:13 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 97774 invoked by uid 500); 5 Dec 2008 13:48:13 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 97763 invoked by uid 99); 5 Dec 2008 13:48:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Dec 2008 05:48:13 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [206.113.196.4] (HELO pollux.corp.prenova.com) (206.113.196.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Dec 2008 13:46:42 +0000 Received: from pollux.corp.prenova.com ([10.1.2.62]) by pollux.corp.prenova.com ([10.1.2.62]) with mapi; Fri, 5 Dec 2008 08:47:03 -0500 From: "Reineri, Jim" To: Log4NET User Date: Fri, 5 Dec 2008 08:47:01 -0500 Subject: RE: Coding horror deadlock Thread-Topic: Coding horror deadlock Thread-Index: AclW0H5Q6Gz+kjgiQfyES+tMNzsM6AADOhLA Message-ID: References: <20852380.post@talk.nabble.com> In-Reply-To: <20852380.post@talk.nabble.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org This is the situation described in Coding Horror: On thread #1, our code was doing Log (lock) / DB stuff (lock) On thread #2, our code was doing DB stuff (lock) / log stuff (lock) The is a classic deadlock example. If thread #1 locks 'Log' at the same ti= me that thread #2 locks 'DB Stuff' then thread #1 will be waiting for the '= DB stuff' lock to be freed before it can complete its work and thread #2 wi= ll be waiting for the 'Log' lock to be freed before completing its work. B= ecause each is waiting on the other, neither will ever release its lock. It is more likely to occur on heavily loaded, multi-core systems. This problem is easily avoided by making sure that any code that needs both= resources applies the locks in the same order. As was pointed out in the article, the problem was not a problem with log4n= et. It really is not a even problem with logging. The problem was really = bad code. The author does make some good points about logging. While I do not necess= arily agree with everything he said, it is worth a read. Cheers, Jim -----Original Message----- From: koger [mailto:karsten@f-kousgaard.dk] Sent: Friday, December 05, 2008 6:56 AM To: log4net-user@logging.apache.org Subject: Coding horror deadlock Hi Those of you who reads coding horror, might have seen this post: http://www.codinghorror.com/blog/archives/001192.html. Could somebody explain me how this deadlock happend? And how do I avoid to get any deadlocks myself using log4net? -- View this message in context: http://www.nabble.com/Coding-horror-deadlock-= tp20852380p20852380.html Sent from the Log4net - Users mailing list archive at Nabble.com.