[
https://issues.apache.org/jira/browse/MBUILDCACHE-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17622538#comment-17622538
]
ASF GitHub Bot commented on MBUILDCACHE-24:
-------------------------------------------
AlexanderAshitkin opened a new pull request, #30:
URL: https://github.com/apache/maven-build-cache-extension/pull/30
Current implementation relies on lifecycle phases presence in
`MojoExecution`. In case of forked execution
`MojoExecution#getLifecyclePhase` could return null which result in IAEs in
multiples places in cache. Proposed fix is to resolve `lifecyclePhase` from the
originating mojo and use it as a lifecycle phase for forked mojos. This looks
quite natural, because forked execution are driven by the originating mojo thus
belonging to the same phase.
Sample exception:
```java
java.lang.IllegalArgumentException: Unsupported phase: null
at org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhase
(LifecyclePhasesHelper.java:121)
at
org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhaseThanClean
(LifecyclePhasesHelper.java:105)
at org.apache.maven.buildcache.LifecyclePhasesHelper.getCleanSegment
(LifecyclePhasesHelper.java:139)
at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute
(BuildCacheMojosExecutionStrategy.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions
(MojoExecutor.java:366)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:167)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000
(MojoExecutor.java:66)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run
(MojoExecutor.java:158)
at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute
(BuildCacheMojosExecutionStrategy.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
(LifecycleModuleBuilder.java:117)
at
org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
(MultiThreadedBuilder.java:196)
at
org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
(MultiThreadedBuilder.java:186)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:624)
```
- [ ] 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.
- [ ] Each commit in the pull request should have a meaningful subject line
and body.
- [ ] 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.
- [ ] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [ ] 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/
> Cache cannot be processed in presence of forked executions
> ----------------------------------------------------------
>
> Key: MBUILDCACHE-24
> URL: https://issues.apache.org/jira/browse/MBUILDCACHE-24
> Project: Maven Build Cache Extension
> Issue Type: Bug
> Reporter: Alexander Ashitkin
> Priority: Major
>
> Current implementation relies on lifecycle phases presence in
> `MojoExecution`. In case of forked execution
> `MojoExecution#getLifecyclePhase` could return null which result in IAEs in
> multiples places in cache:
>
> {code:java}
> java.lang.IllegalArgumentException: Unsupported phase: null
> at org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhase
> (LifecyclePhasesHelper.java:121)
> at
> org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhaseThanClean
> (LifecyclePhasesHelper.java:105)
> at org.apache.maven.buildcache.LifecyclePhasesHelper.getCleanSegment
> (LifecyclePhasesHelper.java:139)
> at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute
> (BuildCacheMojosExecutionStrategy.java:101)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions
> (MojoExecutor.java:366)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:211)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:167)
> at org.apache.maven.lifecycle.internal.MojoExecutor.access$000
> (MojoExecutor.java:66)
> at org.apache.maven.lifecycle.internal.MojoExecutor$1.run
> (MojoExecutor.java:158)
> at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute
> (BuildCacheMojosExecutionStrategy.java:127)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:117)
> at
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
> (MultiThreadedBuilder.java:196)
> at
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call
> (MultiThreadedBuilder.java:186)
> 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:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:624)
>
> {code}
> Proposed fix is to resolve `lifecyclePhase` from the originating mojo and use
> it as a lifecycle phase for forked mojos.
> Optionally, the issue probably could be resolved in maven-core by properly
> setting execution phase.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)