Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 88928 invoked from network); 30 Nov 2009 23:48:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Nov 2009 23:48:30 -0000 Received: (qmail 39419 invoked by uid 500); 30 Nov 2009 23:48:30 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 39351 invoked by uid 500); 30 Nov 2009 23:48:29 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 39342 invoked by uid 99); 30 Nov 2009 23:48:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 23:48:29 +0000 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; Mon, 30 Nov 2009 23:48:27 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id 5AC17234C052; Mon, 30 Nov 2009 15:48:06 -0800 (PST) From: bugzilla@apache.org To: notifications@ant.apache.org Subject: DO NOT REPLY [Bug 48310] New: ConcurrentModificationException with and tasks X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ant X-Bugzilla-Component: Core X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: valentino@miazzo.net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: notifications@ant.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 30 Nov 2009 15:48:06 -0800 (PST) X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=48310 Summary: ConcurrentModificationException with and tasks Product: Ant Version: 1.7.1 Platform: PC OS/Version: Windows XP Status: NEW Severity: major Priority: P2 Component: Core AssignedTo: notifications@ant.apache.org ReportedBy: valentino@miazzo.net This was originally bug 48299 but was lost in issues.a.o data loss on 2009-11-26/27 and re-created from the archives. I have a build system where sometime a ConcurrentModificationException is thrown. The system is quite complex and I'm not able to produce a recipe for the bug. Anyway, I looked at the ANT source code and found the (possible) causes. Method void Project.addReference(String,Object) modifies Hashtable Projet.references . Method Hashtable Project.getReferences() returns references. This implementation exposes to ConcurrentModificationException when Thread A calls addReference() and Thread B iterates over getReferences(). Even if dictionary.keySet().iterator() This actually happens to me when using and tasks. In this case, when scripcondition task is executed, the method void ScriptRunnerBase.bindToComponent(ProjectComponent) invokes Project.getReferences(), then obtains a iterator with Map.keySet().iterator() to fill script beans. In another thread some task modifies calls Project.addReference() and therefore a ConcurrentModificationException is threw. Another problematic scenario is this. Method void Project.addOrReplaceTarget(String,Target) modifies Hashtable Projet.target . Method Hashtable Project.getTargets() returns targets. This implementation exposes to race conditions when Thread A calls addOrReplaceTarget() and Thread B calls getTargets(). I think a copy of those collection should be returned instead of the live ones. I tried to produce a patch but I'm not sure off all the implication of those changes (Javadocs state that these methods return live collections), so I leave this to the maintainers. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.