codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] ant pull request #81: Fix rare ConcurrentModificationException when running ...


GitHub user mharmer opened a pull request:

    https://github.com/apache/ant/pull/81

    Fix rare ConcurrentModificationException when running with Parallel-Ant executor.

    This resolves a rare race condition when running with the [Parallel-Ant](https://github.com/codeaholics/parallel-ant) executor.
    
    This seems to be triggered concurrently when a reference was being added to the project at the same time the references were being copied through Project.getCopyOfReferences(). The stack trace observed in this case was:
    ```
    java.util.ConcurrentModificationException
            at java.util.Hashtable$Enumerator.next(Hashtable.java:1387)
            at java.util.HashMap.putMapEntries(HashMap.java:512)
            at java.util.HashMap.<init>(HashMap.java:490)
            at org.apache.tools.ant.Project.getCopyOfReferences(Project.java:2038)
            at org.apache.tools.ant.util.ScriptRunnerBase.bindToComponent(ScriptRunnerBase.java:307)
            at org.apache.tools.ant.util.ScriptRunnerHelper.getScriptRunner(ScriptRunnerHelper.java:66)
            at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            at org.apache.tools.ant.Task.perform(Task.java:348)
            at org.apache.tools.ant.Target.execute(Target.java:435)
            at org.apache.tools.ant.Target.performTasks(Target.java:456)
            at org.codeaholics.tools.build.pant.AntWrapperImpl.executeTarget(Unknown Source)
            at org.codeaholics.tools.build.pant.DependencyGraphEntry.run(Unknown Source)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pc-doctor/ant ConcurrentModificationReferences

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ant/pull/81.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #81
    
----
commit 01b9073218c9b2f067539bc9f5b21340bf6abd6f
Author: mharmer <mark.harmer@...>
Date:   2018-12-11T22:02:37Z

    Fixing a potential ConcurrentModificationException that could occur when running Ant with the Parallel-Ant executor.

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxx