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

Gradle fails when no incremental compile snapshot data available #6612

Closed
huxi opened this issue Sep 3, 2018 · 9 comments
Closed

Gradle fails when no incremental compile snapshot data available #6612

huxi opened this issue Sep 3, 2018 · 9 comments
Assignees
Milestone

Comments

@huxi
Copy link
Contributor

huxi commented Sep 3, 2018

Gradle 4.10 seems to have introduced a regression...

Expected Behavior

Build should not fail and doesn't fail with Gradle 4.9.

Current Behavior

Build failure:

* What went wrong:
Execution failed for task ':foo:bar:compileJava'.
> No incremental compile snapshot data available for /opt/work/jenkins/.gradle/caches/modules-2/files-2.1/group/artifact/2.0.0-SNAPSHOT/4daa08f12a67d65bff5e27995a212d584080c287/artifact-2.0.0-SNAPSHOT.jar with hash 6cbe03df6f1e3a13b1635d0a7aa3c0f6.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':foo:bar:compileJava'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
	at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
	at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalStateException: No incremental compile snapshot data available for /opt/work/jenkins/.gradle/caches/modules-2/files-2.1/group/artifact/2.0.0-SNAPSHOT/4daa08f12a67d65bff5e27995a212d584080c287/artifact-2.0.0-SNAPSHOT.jar with hash 6cbe03df6f1e3a13b1635d0a7aa3c0f6.
	at org.gradle.api.internal.tasks.compile.incremental.classpath.DefaultClasspathEntrySnapshotCache.getClasspathEntrySnapshots(DefaultClasspathEntrySnapshotCache.java:44)
	at org.gradle.api.internal.tasks.compile.incremental.classpath.SplitClasspathEntrySnapshotCache.getClasspathEntrySnapshots(SplitClasspathEntrySnapshotCache.java:56)
	at org.gradle.api.internal.tasks.compile.incremental.recomp.PreviousCompilation.initSnapshots(PreviousCompilation.java:72)
	at org.gradle.api.internal.tasks.compile.incremental.recomp.PreviousCompilation.getSnapshots(PreviousCompilation.java:65)
	at org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpecProvider.processClasspathChanges(RecompilationSpecProvider.java:48)
	at org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpecProvider.provideRecompilationSpec(RecompilationSpecProvider.java:40)
	at org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler.execute(SelectiveCompiler.java:63)
	at org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler.execute(SelectiveCompiler.java:37)
	at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:59)
	at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:43)
	at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:153)
	at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:121)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
	... 31 more

Context

We had to revert back to Gradle 4.9 for the time being.

Steps to Reproduce (for bugs)

I had no luck reproducing this issue in an isolated example project, unfortunately.

The problem may be related to a dependency that is both a build-internal dependency as well as a transitive dependency, i.e. once referenced via project(..) but also referenced via group:artifact:version. But this is only a guess...

I hope the stacktrace is sufficient since it doesn't make sense that the build would fail in case of a cache miss.

Your Environment

------------------------------------------------------------
Gradle 4.10
------------------------------------------------------------

Build time:   2018-08-27 18:35:06 UTC
Revision:     ee3751ed9f2034effc1f0072c2b2ee74b5dce67d

Kotlin DSL:   1.0-rc-3
Kotlin:       1.2.60
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 2.6.32-754.3.5.el6.x86_64 amd64

I can't provide you with a build scan.

@marcphilipp
Copy link
Contributor

@oehme Could you please check if this could be related to incremental compilation?

@oehme
Copy link
Contributor

oehme commented Sep 4, 2018

I already fixed this on master, can you try with the nightly?

The culprit is a discrepancy between the project cache dir and the user home cache dir. It happens if you build the same project with different user homes. Deleting the .gradle directory in your project should makes it work again.

@oehme oehme added this to the 5.0 RC1 milestone Sep 4, 2018
@oehme oehme self-assigned this Sep 4, 2018
@oehme oehme closed this as completed Sep 4, 2018
@oehme
Copy link
Contributor

oehme commented Sep 4, 2018

I wonder how widespread this is and if we should do a 4.10.1 with the fix (which is trivial).

@ljacomet
Copy link
Member

ljacomet commented Sep 4, 2018

Given that 4.10 is to be the last 4.x I would do so, though we may wait a bit more just in case something else pops up.

@oehme oehme modified the milestones: 5.0 RC1, 4.10.1 Sep 4, 2018
@oehme
Copy link
Contributor

oehme commented Sep 4, 2018

I've changed the target milestone and cherry-picked the fix to release.

@bronogard
Copy link

We have exactly the same problem in a big multi-project build. Would disabling the incremental Java compilation work too?

tasks.withType(JavaCompile) {
 options.incremental = false
}

@oehme
Copy link
Contributor

oehme commented Sep 7, 2018

@bronogard Yes, but make sure to revert that once 4.10.1 is out :)

@bronogard
Copy link

@oehme Perfect, thanks we will do that as soon as 4.10.1 is out. ^^

@admizh
Copy link

admizh commented Sep 9, 2018

oh, same issue. waiting 4.10.1

@wolfs wolfs changed the title Likely regression in Gradle 4.10, probably related to incremental compile. Gradle fails when no incremental compile snapshot data available Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants