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

multhithreading issue using versions:set #54

Closed
geirwr opened this issue Feb 26, 2016 · 8 comments
Closed

multhithreading issue using versions:set #54

geirwr opened this issue Feb 26, 2016 · 8 comments
Labels

Comments

@geirwr
Copy link

geirwr commented Feb 26, 2016

I am doing a versions:set but see some strange behaviour. Looks like it is a matter of non-threadsafe code. I have been testing on linux and windows, maven 3.3.9 and 3.3.1, same behavior.
Increasing number of parallel threads gives issue.

Workaround is to limit the number of parallel threads.

This issue surfaced using jenkins buildserver, and was easy to reproduce locally.

  1. mvn versions:set -DnewVersion=1.0-SNAPSHOT (working)
  2. mvn -X versions:set -DnewVersion=1.0-SNAPSHOT (working)
  3. mvn -T1 versions:set -DnewVersion=1.0-SNAPSHOT (working)
  4. mvn -T1 -e versions:set -DnewVersion=1.0-SNAPSHOT (working)
  5. mvn -T1 -X versions:set -DnewVersion=1.0-SNAPSHOT (working on linux, fails on windows)
  6. mvn -T2 versions:set -DnewVersion=1.0-SNAPSHOT (working)
  7. mvn -T3 versions:set -DnewVersion=1.0-SNAPSHOT (working/fails, 50/50)
  8. mvn -T4 versions:set -DnewVersion=1.0-SNAPSHOT (fails 100%)

[ERROR] java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.multiThreadedProjectTaskSegmentBuild(MultiThreadedBuilder.java:174)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.build(MultiThreadedBuilder.java:91)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.multiThreadedProjectTaskSegmentBuild(MultiThreadedBuilder.java:166)
... 16 more
Caused by: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:189)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

@khmarbaise
Copy link
Member

At the moment the versions-maven-plugin supports also Maven 2 which does not know anything about -T... furthermore there is some code in there which is not thread safe...so we need to lift up the whole plugin to Maven 3+ only...that might solve the problem...but this is not a simple task...so please be patient.

@khmarbaise khmarbaise added this to the 3.0.0 milestone Mar 29, 2016
@geirwr
Copy link
Author

geirwr commented Mar 29, 2016

We have a workaround, so we have the patience.
looking forward to a version lifted to Maven 3...

@khmarbaise
Copy link
Member

khmarbaise commented Feb 12, 2017

So after deeper investigation this is an regression of maven-core. Using Maven 3.0.5 it works without any issue starting with Maven 3.1.1 etc. it will fail with the NPE already created an issue for maven-core and already testing a fix for this....
In other words my previous assumption was wrong.

@khmarbaise khmarbaise removed this from the 3.0.0 milestone Feb 12, 2017
@khmarbaise
Copy link
Member

The promised fix will be part of maven-3.5.0-alpha-2

@khmarbaise
Copy link
Member

Sorry the fix is part for maven-3.5.0-beta-1 instead...which has been released...

@khmarbaise
Copy link
Member

The issue has been fixed with Maven 3.5.0-beta-1 so I close this issue.

@geirwr
Copy link
Author

geirwr commented Apr 13, 2017

thanks,
sorry for blaming versions-maven-plugin, as it turned out to be a maven-core issue.
good thing it is fixed!

@khmarbaise
Copy link
Member

No problem..I wasn't sure at the beginning if it is versions-maven-plugin issue but later I realized it was a maven-core issue...

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

No branches or pull requests

2 participants