With M5, build fails on Ubuntu (but passes on XP)


(jbisotti) #1

I just encountered another hurdle in trying to upgrade our builds to M5. This particular multi-project build works just fine on my Windows XP box; however, it fails while running integration tests under Ubuntu. I also tried with the M6 snapshot I saw mentioned yesterday on the mailing list, but I get the same results with it.

FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':dm-printer-metadata:integTest'.
Cause: Could not resolve all dependencies for configuration ':dm-printer-metadata:integTestRuntime'.
Cause: Cannot lock the artifact cache, as it is already locked by this process.
  * Try:
Run with --info or --debug option to get more log output.
  * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':dm-printer-metadata:integTest'.
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
 at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
 at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
 at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
 at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
 at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
 at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
 at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
 at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
 at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
 at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
 at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
 at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
 at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)
 at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)
 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)
 at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
 at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
 at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:45)
 at org.gradle.launcher.exec.DefaultGradleLauncherActionExecuter.execute(DefaultGradleLauncherActionExecuter.java:49)
 at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:41)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:84)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:82)
 at org.gradle.util.Swapper.swap(Swapper.java:38)
 at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:82)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:48)
 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.HandleSleep.execute(HandleSleep.java:35)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.ReportExceptions.execute(ReportExceptions.java:36)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.ForwardOutput.execute(ForwardOutput.java:46)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:32)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.UpdateDaemonStateAndHandleBusyDaemon.execute(UpdateDaemonStateAndHandleBusyDaemon.java:33)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:34)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSendingCommand.java:21)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:21)
 at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)
 at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:47)
 at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:101)
 at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':dm-printer-metadata:integTestRuntime'.
 at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:47)
 at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandlingArtifactDependencyResolver.java:26)
 at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:80)
 at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:490)
 at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:202)
 at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
 at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:39)
 at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:59)
 at org.gradle.util.GUtil.addToCollection(GUtil.java:134)
 at org.gradle.process.internal.WorkerProcessBuilder.applicationClasspath(WorkerProcessBuilder.java:53)
 at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.processTestClass(ForkingTestClassProcessor.java:56)
 at org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor.processTestClass(RestartEveryNTestClassProcessor.java:45)
 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
 at org.gradle.messaging.dispatch.FailureHandlingDispatch.dispatch(FailureHandlingDispatch.java:29)
 at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)
 at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
 at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)
 ... 1 more
Caused by: java.lang.IllegalStateException: Cannot lock the artifact cache, as it is already locked by this process.
 at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.lockCache(DefaultCacheLockingManager.java:66)
 at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.withCacheLock(DefaultCacheLockingManager.java:52)
 at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$2.get(ResolvedArtifactFactory.java:51)
 at org.gradle.api.internal.artifacts.DefaultResolvedArtifact.getFile(DefaultResolvedArtifact.java:107)
 at org.gradle.api.internal.artifacts.ivyservice.AbstractResolvedConfiguration.doGetFiles(AbstractResolvedConfiguration.java:71)
 at org.gradle.api.internal.artifacts.ivyservice.AbstractResolvedConfiguration.getFiles(AbstractResolvedConfiguration.java:49)
 at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$1.getFiles(SelfResolvingDependencyResolver.java:56)
 at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:78)
 ... 16 more
    BUILD FAILED
  Total time: 2 mins 42.617 secs

Any ideas?

Thanks,

Jamie


(jburbridge) #2

Jamie,

I’m getting the same error while running a multi-project build under Ubuntu with 1.0-milestone-6, though it works fine under OSX on a co-worker’s desktop.

It looks like in you’re case you’re getting the error while trying to assemble the classpath for your integTest configuration – in our case, this happens a bit earlier while assembling testRuntime, which is part of the standard java plug-in… however, for us it only happens when trying to execute the cobertura task (provided with the cobertura plug-in.

I’ve tried re-creating the conditions in a single-project build and can’t seem to reproduce what’s happening. In other words, this works fine in ubuntu:

https://github.com/johnburbridge/gradleBug/blob/master/build.gradle

Can you describe what you’re doing? Or perhaps spot any similarities? I’m going to try and breakt this up into a multi-project build to try and reproduce the issue.


(jburbridge) #3

Turns out the issue is also happening under M6 on Windows 7.

It starts off as “Could not resolve all dependencies for configuration ‘:applications:autotest:testRuntime’.” but it seems as if the root cause is:

I get a similar stacktrace… and this:

FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':applications:autotest:test'.
Cause: Could not resolve all dependencies for configuration ':applications:autotest:testRuntime'.
Cause: Cannot lock the artifact cache, as it is already locked by this process.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  Total time: 1 mins 22.446 secs

I’m still trying to isolate this into a concise / reproducible project tree, but it seems like simplifying the existing project cause the error to go away, so I haven’t quite nailed down the exact magic combination that would cause this to happen.


#4

Thanks for looking into this. Milestone 7 will again have major changes to the dependency cache, including a new, simpler (better) locking mechanism.

I will be great if you can isolate this problem into a simple test case, so that we can add it to our suite of automated tests.


(jburbridge) #5

Hi Daz,

I did work on this a bit more and have updated the git project with the offending code: https://github.com/johnburbridge/gradleBug/blob/master/build.gradle

Seems like a concurrency issue with cobertura during testRuntime if test forking and module dependencies are present at the same time.

Note that this works fine when commenting out either this block:

test {
    forkEvery = 1;
    maxParallelForks = 2;
}

or this block:

axisGenAntTask module('org.apache.axis:axis:1.4') {
        dependency 'javax.xml:jaxrpc-api:1.1';
        dependency 'axis:axis-wsdl4j:1.5.1';
        dependency 'commons-discovery:commons-discovery:0.2';
        dependency 'commons-codec:commons-codec:1.3';
        dependency 'javax.mail:mail:1.3.1';
    }

But the combination of both causes the “Cannot lock the artifact cache, as it is already locked by this process.” exception which is thrown at testRuntime.

I hope this helps!

Cheers, JB