[ 
https://issues.apache.org/jira/browse/MNG-6105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15576748#comment-15576748
 ] 

Michael Osipov commented on MNG-6105:
-------------------------------------

Very interesting approach. ~gboue, what do you think?

> properties.internal.SystemProperties.addSystemProperties() is not really 
> thread-safe
> ------------------------------------------------------------------------------------
>
>                 Key: MNG-6105
>                 URL: https://issues.apache.org/jira/browse/MNG-6105
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.9
>         Environment: Apache Maven 3.3.9 
> (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
> Maven home: /usr/maven/default
> Java version: 1.8.0_102, vendor: Oracle Corporation
> Java home: /usr/java/jdk1.8.0_102/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "2.6.32-431.29.2.el6.x86_64", arch: "amd64", 
> family: "unix"
>            Reporter: Falko Modler
>            Assignee: Guillaume Boué
>
> We got a rather large Maven project with a couble of modules that execute 
> {{maven-assembly-plugin}}. Our build runs in parallel mode via {{-Tx}}.
> From time to time we are seeing following exception causing the respective 
> build to fail:
> {noformat}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-assembly-plugin:2.6:single (assembly-zip) on 
> project some-module: Execution assembly-zip of goal 
> org.apache.maven.plugins:maven-assembly-plugin:2.6:single failed. 
> NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (assembly-zip) 
> on project some-module: Execution assembly-zip of goal 
> org.apache.maven.plugins:maven-assembly-plugin:2.6:single failed.
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>       at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
>       at 
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:181)
>       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)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution 
> assembly-zip of goal 
> org.apache.maven.plugins:maven-assembly-plugin:2.6:single failed.
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
>       ... 11 more
> Caused by: java.lang.NullPointerException
>       at java.util.Hashtable.put(Hashtable.java:459)
>       at 
> org.apache.maven.properties.internal.SystemProperties.addSystemProperties(SystemProperties.java:38)
>       at 
> org.apache.maven.project.artifact.MavenMetadataSource.getSystemProperties(MavenMetadataSource.java:756)
>       at 
> org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:574)
>       at 
> org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:190)
>       at 
> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:532)
>       at 
> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:584)
>       at 
> org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:144)
>       at 
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:493)
>       at 
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveWithExceptions(DefaultArtifactResolver.java:348)
>       at 
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:342)
>       at 
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:321)
>       at 
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:286)
>       at 
> org.apache.maven.plugin.assembly.artifact.DefaultDependencyResolver.resolveTransitively(DefaultDependencyResolver.java:253)
>       at 
> org.apache.maven.plugin.assembly.artifact.DefaultDependencyResolver.resolveDependencySets(DefaultDependencyResolver.java:169)
>       at 
> org.apache.maven.plugin.assembly.archive.phase.DependencySetAssemblyPhase.execute(DependencySetAssemblyPhase.java:94)
>       at 
> org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:178)
>       at 
> org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484)
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>       ... 12 more
> [ERROR] 
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR] 
> [ERROR] For more information about the errors and possible solutions, please 
> read the following articles:
> [ERROR] [Help 1] 
> http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
> {noformat}
> There seems to be concurrent system property removal while 
> {{properties.internal.SystemProperties}} is iterating over the previously 
> calculated property keys:
> {code:java|title=https://github.com/apache/maven/blob/maven-3.3.9/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java}
>     /**
>      * Thread-safe System.properties copy implementation.
>      *
>      * @see "https://issues.apache.org/jira/browse/MNG-5670";
>      */
>     public static void addSystemProperties( Properties props )
>     {
>         for ( String key : System.getProperties().stringPropertyNames() )
>         {
>             props.put( key, System.getProperty( key ) );
>         }
> }
> {code}
> {{System.getProperty( key )}} possibly yields a {{null}} value which 
> {{Hashtable/Properties}} does not accept.
> *Possible solutions*:
> - refrain from adding {{null}} by explicitly checking for it
> - replace {{for}}-loop with {{props.addAll(System.getProperties().clone())}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to