[GRADLE-2249] Sporadic failures due to "Could not load compiled classes for initialization script 'init.gradle' from cache" Created: 24/Apr/12 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | René Gröschke (Inactive) |
Resolution: | Won't Fix | Votes: | 2 |
Description |
I have a CI build that always uses an init script. Every once in a while the build fails with the following error message: Starting Build FAILURE: Build failed with an exception.
This is can be fixed by deleting the workspace. I'm running milestone 9 on linux. Gradle home is set to a local directory. |
Comments |
Comment by Gradle Forums [ 24/Apr/12 ] |
Can you run with the `-s` (show stacktrace) switch and provide the exception trace please. |
Comment by Gradle Forums [ 24/Apr/12 ] |
I've turned on stacktraces on the CI server builds and will post the stacktrace next time the problem recurs. |
Comment by Gradle Forums [ 24/Apr/12 ] |
org.gradle.api.GradleException: Could not load compiled classes for initialization script '/tmp/hudson/workspace/job/gradle/hudson.init.gradle' from cache. |
Comment by Gradle Forums [ 24/Apr/12 ] |
Anyone? I thought I should mention that this problem has been popping every once in a while through a number of gradle releases – it is not new to milestone 9. |
Comment by David Resnick [ 22/Jul/12 ] |
This is still a problem for me. Any suggestions on a workaround? Exactly what file is it failing to load; I can delete it on my CI server to prevent these failed builds. Here is a recent failure trace, using 1.0 with --info. Downloading http://build-svn.eng.com/svn/repository/gradle/gradle-1.0-bin.zip FAILURE: Build failed with an exception.
|
Comment by David Resnick [ 23/Jul/12 ] |
A workaround is to delete the $GRADLE_HOME/caches/1.0/scripts directory. This had stopped working for me because I used $GRADLE_HOME/caches/1.0-* to catch pre-1.0 Gradle releases. |
Comment by David Resnick [ 23/Jul/12 ] |
The gradle command line used (sans tasks): This failed with:
The following files are found in $GRADLE_HOME/caches: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/initscript: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/initscript/classes: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/no_initscript: ./1.0/scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/no_initscript/classes: So the class file can be found in scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/no_initscript/classes but not in scripts/hudson_init_55igr449pb8k222uc4a07o2hf5/InitScript/initscript/classes. |
Comment by David Resnick [ 23/Dec/12 ] |
This is still as relevant as ever, in 1.3 as well as 1.0, 1.1 and 1.2. Note: I tried to update the "Affects versions" field but I don't seem to have the permissions to do so. |
Comment by Adam Murdoch [ 26/Dec/12 ] |
@David, do you have a stack trace from Gradle 1.3? |
Comment by David Resnick [ 27/Dec/12 ] |
@Adam, here's the stack trace: org.gradle.api.GradleException: Could not load compiled classes for initialization script '/tmp/hudson/workspace/proj/gradle/hudson.init.gradle' from cache. Expected class file /tmp/hudson/workspace/proj/gradle/gradle-user-home/caches/1.3/scripts/hudson_init_1g66oc1gavjiouoobrf5lu8if0/InitScript/initscript/classes/hudson_init_1g66oc1gavjiouoobrf5lu8if0.class does not exist. at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.loadFromDir(DefaultScriptCompilationHandler.java:177) at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:58) at org.gradle.groovy.scripts.internal.ShortCircuitEmptyScriptCompiler.compile(ShortCircuitEmptyScriptCompiler.java:35) at org.gradle.groovy.scripts.internal.CachingScriptClassCompiler.compile(CachingScriptClassCompiler.java:36) at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:60) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:114) at org.gradle.configuration.DefaultInitScriptProcessor.process(DefaultInitScriptProcessor.java:37) at org.gradle.initialization.InitScriptHandler.executeScripts(InitScriptHandler.java:41) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:131) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38) at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39) at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50) at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:48) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.Main.main(Main.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) at org.gradle.launcher.GradleMain.main(GradleMain.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) Caused by: java.lang.ClassNotFoundException: hudson_init_1g66oc1gavjiouoobrf5lu8if0 at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.loadFromDir(DefaultScriptCompilationHandler.java:173) ... 38 more |
Comment by David Resnick [ 13/Feb/13 ] |
This might not be the same problem but it is quite similar and happens sometimes with Gradle 1.4. Compiling script '/tmp/hudson/workspace/job/gradle/common.gradle' using BuildScriptTransformer. FAILURE: Build failed with an exception. * Where: Build file '/tmp/hudson/workspace/job/build.gradle' line: 32 * What went wrong: A problem occurred evaluating root project 'proj'. > Could not open no_buildscript class cache for script '/tmp/hudson/workspace/job/gradle/common.gradle' (/tmp/hudson/workspace/job/gradle/gradle-user-home/caches/1.4/scripts/common_3cphbq9dr7ovpqblfe6o4o927g/DefaultScript/no_buildscript). > BUG! exception in phase 'semantic analysis' in source unit 'common_3cphbq9dr7ovpqblfe6o4o927g' null * Try: Run with --debug option to get more log output. * Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'proj'. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127) at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38) at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:466) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77) at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23) at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21) at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:78) at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:130) at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:442) at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:437) at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:40) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38) at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39) at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50) at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:48) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.Main.main(Main.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) at org.gradle.launcher.GradleMain.main(GradleMain.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) Caused by: org.gradle.cache.CacheOpenException: Could not open no_buildscript class cache for script '/tmp/hudson/workspace/job/gradle/common.gradle' (/tmp/hudson/workspace/job/gradle/gradle-user-home/caches/1.4/scripts/common_3cphbq9dr7ovpqblfe6o4o927g/DefaultScript/no_buildscript). at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:55) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:27) at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.doOpenDir(DefaultCacheFactory.java:72) at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.open(DefaultCacheFactory.java:111) at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:184) at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:134) at org.gradle.cache.internal.DefaultCacheRepository$AbstractCacheBuilder.open(DefaultCacheRepository.java:121) at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:51) at org.gradle.groovy.scripts.internal.ShortCircuitEmptyScriptCompiler.compile(ShortCircuitEmptyScriptCompiler.java:35) at org.gradle.groovy.scripts.internal.CachingScriptClassCompiler.compile(CachingScriptClassCompiler.java:36) at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:60) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:121) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyScript(DefaultObjectConfigurationAction.java:82) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$000(DefaultObjectConfigurationAction.java:32) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$1.run(DefaultObjectConfigurationAction.java:54) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114) at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:854) at org.gradle.api.Project$apply.call(Unknown Source) at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34) at org.gradle.api.Script$apply.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at build_57n0sugq5ja7vh76gbl5da4685.run(/tmp/hudson/workspace/job/build.gradle:32) at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52) ... 43 more Caused by: BUG! exception in phase 'semantic analysis' in source unit 'common_3cphbq9dr7ovpqblfe6o4o927g' null at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:847) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:118) at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:67) at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CacheInitializer.execute(FileCacheBackedScriptClassCompiler.java:80) at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CacheInitializer.execute(FileCacheBackedScriptClassCompiler.java:65) at org.gradle.cache.internal.DefaultPersistentDirectoryCache.buildCacheDir(DefaultPersistentDirectoryCache.java:100) at org.gradle.cache.internal.DefaultPersistentDirectoryCache.access$100(DefaultPersistentDirectoryCache.java:36) at org.gradle.cache.internal.DefaultPersistentDirectoryCache$1$1.run(DefaultPersistentDirectoryCache.java:82) at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:165) at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:154) at org.gradle.cache.internal.DefaultPersistentDirectoryCache$1.execute(DefaultPersistentDirectoryCache.java:80) at org.gradle.cache.internal.DefaultPersistentDirectoryCache$1.execute(DefaultPersistentDirectoryCache.java:70) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.withExclusiveLock(DefaultPersistentDirectoryStore.java:74) at org.gradle.cache.internal.DefaultPersistentDirectoryCache.init(DefaultPersistentDirectoryCache.java:70) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:47) ... 67 more Caused by: java.lang.NullPointerException at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:275) at org.codehaus.groovy.control.ResolveVisitor.resolveFromDefaultImports(ResolveVisitor.java:466) at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:275) at org.codehaus.groovy.control.ResolveVisitor.resolveFromStaticInnerClasses(ResolveVisitor.java:432) at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:275) at org.codehaus.groovy.control.ResolveVisitor.resolveFromModule(ResolveVisitor.java:648) at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:275) at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:243) at org.codehaus.groovy.control.ResolveVisitor.transformPropertyExpression(ResolveVisitor.java:881) at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:744) at org.codehaus.groovy.control.ResolveVisitor.transformBinaryExpression(ResolveVisitor.java:984) at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:748) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40) at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:165) at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1341) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:50) at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:173) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1284) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148) at org.codehaus.groovy.control.CompilationUnit$9.call(CompilationUnit.java:605) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:843) ... 85 more BUILD FAILED |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |