Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 34640 invoked from network); 12 Oct 2008 21:33:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Oct 2008 21:33:06 -0000 Received: (qmail 45991 invoked by uid 500); 12 Oct 2008 21:33:05 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 45969 invoked by uid 500); 12 Oct 2008 21:33:05 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 45954 invoked by uid 99); 12 Oct 2008 21:33:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Oct 2008 14:33:05 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Oct 2008 21:32:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 348A8234C219 for ; Sun, 12 Oct 2008 14:32:44 -0700 (PDT) Message-ID: <96277736.1223847164213.JavaMail.jira@brutus> Date: Sun, 12 Oct 2008 14:32:44 -0700 (PDT) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-3909) Race condition in NetXAResource.removeXaresFromSameRMchain() In-Reply-To: <659137971.1223745584276.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-3909: -------------------------------------- Derby Info: [Patch Available] > Race condition in NetXAResource.removeXaresFromSameRMchain() > ------------------------------------------------------------ > > Key: DERBY-3909 > URL: https://issues.apache.org/jira/browse/DERBY-3909 > Project: Derby > Issue Type: Bug > Components: Network Client > Affects Versions: 10.5.0.0 > Reporter: Knut Anders Hatlen > Assignee: Knut Anders Hatlen > Attachments: d3909-remove.diff, d3909.diff, Derby3909.java > > > NetXAResource.removeXaresFromSameRMchain() does the following to remove a NetXAResource from what's logically a singly-linked list: > 1) Mark the NetXAResource to remove with a flag (a field called ignoreMe_) > 2) Synchronize on an object that protects the linked list > 3) Follow the chain of next pointers in the linked list and remove the first flagged object > 4) Release synchronization lock obtained in (2) > 5) Clear the flag set in (1) > Now, say that two threads (T1 and T2) perform step 1 in parallel. T1 is granted the synchronization lock in (2), and T2 must wait. T1 traverses the linked list, finds the object flagged by T2 and removes it. Further T1 releases the synchronization lock and clears the flag on the object it had flagged. This is not the same object that it removed, so when T2 is granted the synchronization lock, there is no object flagged for removal. As a result, only the object T2 attempted to remove was in fact removed. The object that T1 flagged for removal is still in the linked list. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.