NPE while resolving dependencies from cache with gradle 2.14.1

issue-acknowledged
gradle-3559

(Manfred Schenk) #1

We are facing some NPEs during dependency resolving from cache in our build environment. Unfortunetaly it doesn’t happen in every build but justs sporadic. From my understanding of the source code mentioned in the stacktrace it should be the getLock() method which returns a null instead of a FileLock instance.

Gradle Version: 2.14.1
Operating System and JVM version: Windows Server 2008R2
Is this a regression? If yes, which version of Gradle do you know it last worked for?
It only happens sporadic - not in every build - could be a locking problem.

Stacktrace:

error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:91)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.process(ComponentMetaDataResolveState.java:66)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.resolve(ComponentMetaDataResolveState.java:45)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:116)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:99)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:72)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:59)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolversChain$ComponentMetaDataResolverChain.resolve(ComponentResolversChain.java:80)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:44)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.resolve(DependencyGraphBuilder.java:564)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.getMetaData(DependencyGraphBuilder.java:574)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:260)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:234)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:141)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:90)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:80)
error	13-Sep-2016 09:37:17		at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.java:80)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:41)
error	13-Sep-2016 09:37:17		at org.gradle.internal.Factories$1.create(Factories.java:22)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:39)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:91)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyConfigurationResolver.resolve(SelfResolvingDependencyConfigurationResolver.java:40)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolve(ShortCircuitEmptyConfigurationResolver.java:52)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolve(ErrorHandlingConfigurationResolver.java:43)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:372)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:347)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getBuildDependencies(DefaultConfiguration.java:417)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getBuildDependencies(Unknown Source)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:92)
error	13-Sep-2016 09:37:17		at org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:202)
error	13-Sep-2016 09:37:17		at org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:112)
error	13-Sep-2016 09:37:17		at org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:64)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.doResolve(CachingTaskDependencyResolveContext.java:76)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.resolve(CachingTaskDependencyResolveContext.java:65)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:55)
error	13-Sep-2016 09:37:17		at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.addToTaskGraph(DefaultTaskExecutionPlan.java:139)
error	13-Sep-2016 09:37:17		at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:98)
error	13-Sep-2016 09:37:17		at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:47)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$000(DefaultBuildConfigurationActionExecuter.java:25)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.proceed(DefaultBuildConfigurationActionExecuter.java:54)
error	13-Sep-2016 09:37:17		at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:48)
error	13-Sep-2016 09:37:17		at org.gradle.execution.DefaultBuildConfigurationActionExecuter.select(DefaultBuildConfigurationActionExecuter.java:36)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher$3.run(DefaultGradleLauncher.java:142)
error	13-Sep-2016 09:37:17		at org.gradle.internal.Factories$1.create(Factories.java:22)
error	13-Sep-2016 09:37:17		at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
error	13-Sep-2016 09:37:17		at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:139)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
error	13-Sep-2016 09:37:17		at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
error	13-Sep-2016 09:37:17		at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
error	13-Sep-2016 09:37:17		at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
error	13-Sep-2016 09:37:17		at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
error	13-Sep-2016 09:37:17		at org.gradle.util.Swapper.swap(Swapper.java:38)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:40)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
error	13-Sep-2016 09:37:17		at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237)
error	13-Sep-2016 09:37:17		at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
error	13-Sep-2016 09:37:17		at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
error	13-Sep-2016 09:37:17		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
error	13-Sep-2016 09:37:17		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
error	13-Sep-2016 09:37:17		at java.lang.Thread.run(Thread.java:745)
error	13-Sep-2016 09:37:17	Caused by: java.lang.NullPointerException
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultCacheAccess$UnitOfWorkFileAccess.writeFile(DefaultCacheAccess.java:404)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache.getCache(DefaultMultiProcessSafePersistentIndexedCache.java:91)
error	13-Sep-2016 09:37:17		at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache.get(DefaultMultiProcessSafePersistentIndexedCache.java:33)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.modulecache.DefaultModuleMetaDataCache.getCachedModuleDescriptor(DefaultModuleMetaDataCache.java:66)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveComponentMetaDataFromCache(CachingModuleComponentRepository.java:158)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveComponentMetaData(CachingModuleComponentRepository.java:154)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.BaseModuleComponentRepositoryAccess.resolveComponentMetaData(BaseModuleComponentRepositoryAccess.java:42)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedModuleComponentRepository$CachedAccess.resolveComponentMetaData(InMemoryCachedModuleComponentRepository.java:75)
error	13-Sep-2016 09:37:17		at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:89)
error	13-Sep-2016 09:37:17		... 106 more ```

(Benjamin Muschko) #2

Thanks for reporting the issue. This looks like a synchronization issue to me.

I would like to ask you for two favors:

  1. Is there any chance you could provide us with a Build Scan? It would help us understand your environment and the operational parameters you are using when running the build.
  2. I’d be interested to know if you run into the same issue with Gradle 3.0. Would it be possible to upgrade your project and see if the issue still occurs for you?

(Manfred Schenk) #3

Thanks for your fast reply.

Due to legal reasons we can not provide you with a Build Scan. At least not for the project in which the problem occurs at the moment.
An upgrade to Gradle 3.0 is also not possibly at the moment. But this upgrade is already scheduled for the end of this month. So we hope to be able to provide you with information if the error still occurs with gradle 3.0 at the beginning of october.


(Benjamin Muschko) #4

Sounds good. Let us know when you have more information. For now I created GRADLE-3559 to track the issue.