You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/11/27 16:38:27 UTC
DO NOT REPLY [Bug 48299] New: ConcurrentModificationException with
and tasks
https://issues.apache.org/bugzilla/show_bug.cgi?id=48299
Summary: ConcurrentModificationException with <parallel> and
<scriptcondition> 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
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 <parallel> and <scriptcondition> 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.
Thanks,
Valentino
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 48299] ConcurrentModificationException with
and tasks
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48299
valentino miazzo <va...@miazzo.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |valentino@miazzo.net
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.