You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alexander Ashitkin (Jira)" <ji...@apache.org> on 2022/10/30 20:28:00 UTC

[jira] [Updated] (MBUILDCACHE-25) Project processed multiple time in presence of forked executions

     [ https://issues.apache.org/jira/browse/MBUILDCACHE-25?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Ashitkin updated MBUILDCACHE-25:
------------------------------------------
    Summary: Project processed multiple time in presence of forked executions  (was: Project checksum recalculated multiple time in presence of forked executions)

> Project processed multiple time in presence of forked executions
> ----------------------------------------------------------------
>
>                 Key: MBUILDCACHE-25
>                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-25
>             Project: Maven Build Cache Extension
>          Issue Type: Bug
>            Reporter: Alexander Ashitkin
>            Priority: Minor
>
> In forked executions present in build, project checksum will be calculated multiple times, one time for project itself + 1 time for each forked execution (could be 5, 10 - any times)
> The issue is manifested by multiple cache calculation log records for the same project:
> {noformat}
> LOGGER.info( "Going to calculate checksum for project [groupId=" + project.getGroupId()
>         + ", artifactId=" + project.getArtifactId() + "]" );{noformat}
> The issue initially observed with PMD and Spotbugs plugins
> h3. Impact
> No functional impact observed, just performance penalty on cache in case of initial calculation
> h3. Cause 
> For every forked execution MojoExecutor clones project per forked execution. Each forked project goes through full cache lifecycle:
> {code:java}
> // public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session,
>                                                    ProjectIndex projectIndex )
>     throws LifecycleExecutionException
> {
> ...
>     Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions();
>     if ( !forkedExecutions.isEmpty() )
>     {
>         ...
>         try
>         {
>             for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() )
>             {
>                 MavenProject executedProject = forkedProject.clone();
>                 forkedProject.setExecutionProject( executedProject );
>                 List<MojoExecution> mojoExecutions = fork.getValue();
>                 ...
>                 try
>                 {
>                     ...
>                     // here cloned project enters cache as a standalone project
>                     execute( session, mojoExecutions, projectIndex );{code}
> Additional notes: the cloning doesn't affect effective pome, so checksum is stable and the same in all calculations
> Proposed solution: reuse calculated inputs from cache
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)