Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException running add-third-party goal #354

Closed
Stephan202 opened this issue Sep 22, 2019 · 2 comments
Closed

ConcurrentModificationException running add-third-party goal #354

Stephan202 opened this issue Sep 22, 2019 · 2 comments

Comments

@Stephan202
Copy link
Contributor

Today I observed the following build failure, after many successful executions of the add-third-party goal in various large (concurrent) Maven builds:

[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.0.0:add-third-party (check-third-party-licenses) on project some-internal-project: could not init goal AddThirdPartyMojo for reason : null: ConcurrentModificationException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.0.0:add-third-party (check-third-party-licenses) on project some-internal-project: could not init goal AddThirdPartyMojo for reason : null
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Caused by: org.apache.maven.plugin.MojoExecutionException: could not init goal AddThirdPartyMojo for reason : null
    at org.codehaus.mojo.license.AbstractLicenseMojo.execute (AbstractLicenseMojo.java:185)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.util.ConcurrentModificationException
    at java.util.TreeMap$PrivateEntryIterator.nextEntry (TreeMap.java:1208)
    at java.util.TreeMap$EntryIterator.next (TreeMap.java:1244)
    at java.util.TreeMap$EntryIterator.next (TreeMap.java:1239)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2554)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2578)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2546)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2578)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2546)
    at java.util.TreeMap.buildFromSorted (TreeMap.java:2503)
    at java.util.TreeMap.putAll (TreeMap.java:318)
    at org.codehaus.mojo.license.api.DependenciesTool.loadProjectDependencies (DependenciesTool.java:120)
    at org.codehaus.mojo.license.api.DefaultThirdPartyHelper.loadDependencies (DefaultThirdPartyHelper.java:152)
    at org.codehaus.mojo.license.AddThirdPartyMojo.loadDependencies (AddThirdPartyMojo.java:226)
    at org.codehaus.mojo.license.AbstractAddThirdPartyMojo.init (AbstractAddThirdPartyMojo.java:750)
    at org.codehaus.mojo.license.AbstractLicenseMojo.execute (AbstractLicenseMojo.java:171)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)

The issue is that DefaultThirdPartyHelper#artifactCache is shared between (and updated by) multiple threads without sufficient synchronization. I'll open a PR with a suggested fix.

@bjanczak
Copy link

What is a status of that issue. We have experienced similar one.

@Stephan202
Copy link
Contributor Author

@bjanczak there's a PR for this issue (#355), but this plugin does not appear to be actively maintained 😞 . We're also still hitting this issue frequently.

Can one of the maintainers please have a look at this ☝️ PR? It's a very tiny fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants