You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/01/06 10:51:56 UTC

[GitHub] [maven] kodeva opened a new pull request #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

kodeva opened a new pull request #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310
 
 
   # Description
   The MavenProject objects are shared among all build threads via `MavenSession` - member `org.apache.maven.execution.MavenSession#projects`.
   As all the `MavenSession` objects are created by cloning an initial `MavenSession` object, I have added cloning of projects into the `MavenSession#clone` method.
   With this change each build has its own copy of `MavenProject` objects and this way unintention changes of the objects from different build threads is avoided.
   
   -----
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
rfscholte commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-571317501
 
 
   I wonder if this is the correct fix. This is pretty old code I guess, but I'd like to know why the cloning is required. We've work quite a lot on performance improvements and minimizing the memoryfootprint lately, cloning would have a counter effect.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612863373
 
 
   This was added 10 years ago: https://github.com/apache/maven/commit/0ce5541bb5c92b87e2425efceee1aad53f415128

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612863373
 
 
   This was added 10 years ago: https://github.com/apache/maven/commit/0ce5541bb5c92b87e2425efceee1aad53f415128 ([MNG-4795 "[regression] Dependencies in forked reactor projects are not resolved when aggregator bound to lifecycle forks"](https://issues.apache.org/jira/browse/MNG-4795))

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-613078824
 
 
   This is interesting and a bit frustating: neither this PR nor another approach I implemented locally (with `ThreadLocal`) are able to fix this problem for me.
   On the other hand it does not really surprise me, given all the mutating methods in `MavenProject` (`set*`) that seem like a bit of a mess in combination with concurrent access...
   
   @kodeva Can you verify that this PR fixes your problem?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612863373
 
 
   This was added 10 years ago: https://github.com/apache/maven/commit/0ce5541bb5c92b87e2425efceee1aad53f415128#diff-2d99239b7db610b69d251224cdf93dc6R269-R277
   Ticket: [MNG-4795 "[regression] Dependencies in forked reactor projects are not resolved when aggregator bound to lifecycle forks"](https://issues.apache.org/jira/browse/MNG-4795)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod edited a comment on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612659076
 
 
   I am also affected by this rather severe bug (see Jira issue [MNG-6843](https://issues.apache.org/jira/browse/MNG-6843?focusedCommentId=17081328&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17081328)).
   
   I had a look at the code involved (before this PR patch) and I do not understand why `MojoExecutor.ensureDependenciesAreResolved()` is setting the `ArtifactFilter` for _multiple_ projects?!
   ```java
           ArtifactFilter artifactFilter = getArtifactFilter( mojoDescriptor );
           List<MavenProject> projectsToResolve =
               LifecycleDependencyResolver.getProjects( session.getCurrentProject(), session,
                                                        mojoDescriptor.isAggregator() );
           for ( MavenProject projectToResolve : projectsToResolve )
           {
               projectToResolve.setArtifactFilter( artifactFilter );
           }
   ```
   The next step after `ensureDependenciesAreResolved()` is the actual execution of the respective mojo via `org.apache.maven.plugin.BuildPluginManager.executeMojo(MavenSession, MojoExecution)`.
   The default implementation (`DefaultBuildPluginManager`) is only operating on a _single_ `MavenProject`, _not multiple_ ones.
   
   Am I missing something, @rfscholte?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
rfscholte commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612792196
 
 
   This will require some good analysis, maybe an annotate/blame on the sourcecode give a hint.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612903224
 
 
   Three ITs fail when just setting the `ArtifactFilter` for `dependencyContext.getProject()`:
   ```
   [ERROR] Failures:
   [ERROR]   MavenITmng4320AggregatorAndDependenciesTest>AbstractMavenIntegrationTestCase.runTest:222->testit:65 [test-classes, classes]
   [ERROR]   MavenITmng4331DependencyCollectionTest>AbstractMavenIntegrationTestCase.runTest:222->testitCliAggregator:86 []
   [ERROR]   MavenITmng5135AggregatorDepResolutionModuleExtensionTest>AbstractMavenIntegrationTestCase.runTest:222->testit:63 [test-classes, classes]
   [INFO]
   [ERROR] Tests run: 826, Failures: 3, Errors: 0, Skipped: 0
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612982701
 
 
   > This was added 10 years ago: [0ce5541#diff-2d99239b7db610b69d251224cdf93dc6R269-R277](https://github.com/apache/maven/commit/0ce5541bb5c92b87e2425efceee1aad53f415128#diff-2d99239b7db610b69d251224cdf93dc6R269-R277)
   > Ticket: [MNG-4795 "[regression] Dependencies in forked reactor projects are not resolved when aggregator bound to lifecycle forks"](https://issues.apache.org/jira/browse/MNG-4795)
   
   I need to correct myself: This is the first commit that added the filter handling: https://github.com/apache/maven/commit/d0d3f58fff0434dc2c3e708c411cd731c0b3bf65
   Ticket: [MNG-4526 [regression] Shade plugin includes too much (relative to 2.2.1)](https://issues.apache.org/jira/browse/MNG-4526)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
famod commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-612659076
 
 
   I am also affected by this rather severe bug (see Jira issue [MNG-6843](https://issues.apache.org/jira/browse/MNG-6843?focusedCommentId=17081328&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17081328)).
   
   I had a look at the code involved (before this PR patch) and I do not understand why `MojoExecutor.ensureDependenciesAreResolved()` is setting the `ArtifactFilter` for _multiple_ projects?!
   ```java
           ArtifactFilter artifactFilter = getArtifactFilter( mojoDescriptor );
           List<MavenProject> projectsToResolve =
               LifecycleDependencyResolver.getProjects( session.getCurrentProject(), session,
                                                        mojoDescriptor.isAggregator() );
           for ( MavenProject projectToResolve : projectsToResolve )
           {
               projectToResolve.setArtifactFilter( artifactFilter );
           }
   ```
   The next step after `ensureDependenciesAreResolved()` is the actual execution of the respective mojo via `org.apache.maven.plugin.BuildPluginManager.executeMojo(MavenSession, MojoExecution)`.
   The default implementation (`DefaultBuildPluginManager`) is only operating on a single `MavenProject`, not multiple ones.
   
   Am I missing something, @rfscholte?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] kodeva commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath

Posted by GitBox <gi...@apache.org>.
kodeva commented on issue #310: [MNG-6843] - Parallel build fails due to missing JAR artifacts in compilePath
URL: https://github.com/apache/maven/pull/310#issuecomment-571483072
 
 
   The usage of cloned MavenSession objects with shallow copy of MavenProject objects is not thread-safe when it comes to parallel builds because the MavenProjects are being modified from multiple threads. See the https://issues.apache.org/jira/browse/MNG-6843 issue.
   
   I don't have big insight in maven code and thus yep, this change fixes something while it might be breaking something different not covered by automated tests. And, most probably, there's another better fix for the issue.
   
   I'll try to create a project that simulates the issue deterministically and that can be publicly shared.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services