Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
ConcurrentModificationException

ConcurrentModificationException

2007-01-11       - By Matt Benson
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Hi--
there appear to be synchronization issues around Ant's
properties.  Here, setting a property (I imagine) and
getting all properties (<ant inheritAll="true">) in
<parallel> can sometimes throw the comod exception.  A
possible workaround would be to use inheritAll="false"
(true is default) and specify only the properties you
need for your sub-builds, if any.

As far as I can tell Ant 1.6.5 should exhibit the same
problem; to track this I have entered
http://issues.apache.org/bugzilla/show_bug.cgi?id=41353

Thanks for the report,
Matt

--- Thomas Voigt <tv_spambox@(protected)> wrote:

> Hi,
>
> we recently started to get
> ConcurrentModificationExceptions with ant. We use
> ant 1.7 and ant-contrib 1.02b2 with jdk 1.5.0_07
> (the same error occurs with jdk 1.5.0_10) on Windows
> Server 2003.
>
> The exception is not exactly reproducable, but seems
> to occur rather frequently. Top-level we use ant to
> run several compile processes in parallel (with
> threadsPerProcessor="1" on a 4-processor machine),
> where each parallel call is a macro which starts a
> new ant process in a subdirectory. So basically we
> call
> <parallel>
> <my_macro subdir="dir1"/>
> <my_macro subdir="dir2"/>
> [...]
> <my_macro subdir="dirN"/>
> </parallel>
> and the macro checks if the subdir is available (in
> case only part of the project is checked out) and
> decides whether to execute the task in a trycatch
> block or not (based on a property).
>
> The exception seems to happen always at the start of
> such a <parallel> block. Unfortunately I can't
> pinpoint the reason to a specific change, since we
> upgraded both ant (to 1.7) and java (to 1.5), and
> did some modifications to the scripts. (I'll try
> combinations of ant 1.6 and java 1.4 with the old
> scripts, but since a complete build takes quite some
> time there is no quick way to try all combinations.)
>
> Any ideas are appreciated. Below is part of a stack
> trace (holler if you need more).
>
> Regards, Thomas
>
> The following error occurred while executing this
> line:
> [...]
> D:\[...]\macros.xml:42:
> java.util.ConcurrentModificationException
>   at
>
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper
.java:541)
>   at
>
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
>   at
>
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
>   at
> sun.reflect.GeneratedMethodAccessor21.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at
>
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
> org.apache.tools.ant.Target.execute(Target.java:357)
>   at
>
org.apache.tools.ant.Target.performTasks(Target.java:385)
>   at
>
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>   at
>
org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>   at
>
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java
:41)
>   at
>
org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>   at
> org.apache.tools.ant.Main.runBuild(Main.java:698)
>   at
> org.apache.tools.ant.Main.startAnt(Main.java:199)
>   at
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>   at
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: [...]
> D:\[...]\mb-macros.xml:42:
> java.util.ConcurrentModificationException
>   at
>
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper
.java:541)
>   at
>
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
>   at
>
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Parallel$TaskRunnable.run(Parallel.java:428)
>   at java.lang.Thread.run(Thread.java:595)
> Caused by:
>
> [roughly 20 caused by/nested exception stack traces
> later]
>
>
> --- Nested Exception ---
> D:\[...]\mb-macros.xml:42:
> java.util.ConcurrentModificationException
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
>   at
> sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at
>
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
>   at
> sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at
>
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Parallel$TaskRunnable.run(Parallel.java:428)
>   at java.lang.Thread.run(Thread.java:595)
> Caused by: java.util.ConcurrentModificationException
>   at
>
java.util.Hashtable$Enumerator.next(Hashtable.java:1020)
>   at java.util.Hashtable.putAll(Hashtable.java:469)
>   at java.util.Hashtable.<init>(Hashtable.java:201)
>   at
>
org.apache.tools.ant.PropertyHelper.getProperties(PropertyHelper.java:473)
>   at
>
org.apache.tools.ant.Project.getProperties(Project.java:626)
>   at
>
org.apache.tools.ant.taskdefs.Ant.initializeProject(Ant.java:208)
>   at
>
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:321)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   ... 50 more
> --- Nested Exception ---
> java.util.ConcurrentModificationException
>   at
>
java.util.Hashtable$Enumerator.next(Hashtable.java:1020)
>   at java.util.Hashtable.putAll(Hashtable.java:469)
>   at java.util.Hashtable.<init>(Hashtable.java:201)
>   at
>
org.apache.tools.ant.PropertyHelper.getProperties(PropertyHelper.java:473)
>   at
>
org.apache.tools.ant.Project.getProperties(Project.java:626)
>   at
>
org.apache.tools.ant.taskdefs.Ant.initializeProject(Ant.java:208)
>   at
>
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:321)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
>   at
> sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at
>
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
>   at
> sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at
>
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
>   at
>
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>   at
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown
> Source)
>   at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:585)
>   at
>
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>   at org.apache.tools.ant.Task.perform(Task.java:348)
>   at
>
org.apache.tools.ant.taskdefs.Parallel$TaskRunnable.run(Parallel.java:428)
>   at java.lang.Thread.run(Thread.java:595)
>
> --
> Der GMX SmartSurfer hilft bis zu 70% Ihrer
> Onlinekosten zu sparen!
> Ideal f?r Modem und ISDN:
> http://www.gmx.net/de/go/smartsurfer
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)
>
>




_______________________________________________________________________________
_____
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.