When trying to run a second build of my project when another build is already running, gradle will wait and eventually time out locking the cache in the buildSrc project.
I have included a trivial project which demonstrates the problem.
Running gradle jettyRun, followed by a gradle jettyStop in another terminal, the second gradle instance will timeout with the following stacktrace:
FAILURE: Build failed with an exception.
- What went wrong:
Could not open cache directory buildSrc (D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc).
Cause: Timeout waiting to lock cache directory buildSrc (D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc). It is currently in use by another Gradle instance.
Owner PID: 6896
Our PID: 7076
Owner Operation:
Our operation:
Lock file: D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc\cache.properties.lock
- Try:
Run with --info or --debug option to get more log output.
- Exception is:
org.gradle.cache.CacheOpenException: Could not open cache directory buildSrc (D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc).
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:53)
at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.doOpenDir(DefaultCacheFactory.java:62)
at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.openStateCache(DefaultCacheFactory.java:105)
at org.gradle.cache.internal.DefaultCacheRepository$StateCacheBuilder.doOpen(DefaultCacheRepository.java:226)
at org.gradle.cache.internal.DefaultCacheRepository$StateCacheBuilder.doOpen(DefaultCacheRepository.java:219)
at org.gradle.cache.internal.DefaultCacheRepository$AbstractCacheBuilder.open(DefaultCacheRepository.java:113)
at org.gradle.initialization.BuildSourceBuilder.createBuildSourceClasspath(BuildSourceBuilder.java:86)
at org.gradle.initialization.BuildSourceBuilder.buildAndCreateClassLoader(BuildSourceBuilder.java:57)
at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:84)
at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:46)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:238)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:222)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: org.gradle.cache.internal.LockTimeoutException: Timeout waiting to lock cache directory buildSrc (D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc). It is currently in use by another Gradle instance.
Owner PID: 6896
Our PID: 7076
Owner Operation:
Our operation:
Lock file: D:\prg\projects\example\buildSrc\.gradle\noVersion\buildSrc\cache.properties.lock
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.lock(DefaultFileLockManager.java:232)
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.<init>(DefaultFileLockManager.java:98)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:68)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:56)
at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:75)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:45)
... 27 more
|