Gradle 1.7 build fails because of java.net.BindException: Permission denied


(Shekhar Gulati) #1

I am trying to use Gradle 1.7 to build my OpenShift Java projects. Everything worked with 1.6 version but with 1.7 version I am getting following exception

remote: 10:05:22.820 [ERROR] [org.gradle.BuildExceptionReporter]

remote: 10:05:22.824 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. remote: 10:05:22.836 [ERROR] [org.gradle.BuildExceptionReporter]

remote: 10:05:22.837 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: remote: 10:05:22.839 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring root project ‘repo’. remote: 10:05:22.840 [ERROR] [org.gradle.BuildExceptionReporter] > Could not open buildscript class cache for build file ‘/var/lib/openshift/520b74b8500446edd3000186/app-root/runtime/repo/build.gradle’ (/var/lib/openshift/520b74b8500446edd3000186/app-root/data/gradle/caches/1.7/scripts/build_416ggqfatcljkcdnbfc8ohkj7t/ProjectScript/buildscript). remote: 10:05:22.848 [ERROR] [org.gradle.BuildExceptionReporter]

java.net.BindException: Permission denied remote: 10:05:22.854 [ERROR] [org.gradle.BuildExceptionReporter]

remote: 10:05:22.856 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: remote: 10:05:22.910 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project ‘repo’. remote: 10:05:22.912 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79) remote: 10:05:22.914 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:57) remote: 10:05:22.919 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:469) remote: 10:05:22.920 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77) remote: 10:05:22.922 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31) remote: 10:05:22.923 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142) remote: 10:05:22.931 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) remote: 10:05:22.932 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) remote: 10:05:22.933 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64) remote: 10:05:22.935 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) remote: 10:05:22.936 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) remote: 10:05:22.938 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35) remote: 10:05:22.939 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) remote: 10:05:22.941 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50) remote: 10:05:22.943 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) remote: 10:05:22.950 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201) remote: 10:05:22.952 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174) remote: 10:05:22.953 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170) remote: 10:05:23.002 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139) remote: 10:05:23.010 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) remote: 10:05:23.012 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) remote: 10:05:23.036 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48) remote: 10:05:23.037 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) remote: 10:05:23.053 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39) remote: 10:05:23.053 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50) remote: 10:05:23.058 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32) remote: 10:05:23.059 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:26) remote: 10:05:23.059 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.cache.CacheOpenException: Could not open buildscript class cache for build file ‘/var/lib/openshift/520b74b8500446edd3000186/app-root/runtime/repo/build.gradle’ (/var/lib/openshift/520b74b8500446edd3000186/app-root/data/gradle/caches/1.7/scripts/build_416ggqfatcljkcdnbfc8ohkj7t/ProjectScript/buildscript). remote: 10:05:23.060 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:55) remote: 10:05:23.060 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:27) remote: 10:05:23.064 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.doOpenDir(DefaultCacheFactory.java:72) remote: 10:05:23.065 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheFactory$CacheFactoryImpl.open(DefaultCacheFactory.java:111) remote: 10:05:23.066 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:184) remote: 10:05:23.066 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.doOpen(DefaultCacheRepository.java:134) remote: 10:05:23.067 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheRepository$AbstractCacheBuilder.open(DefaultCacheRepository.java:121) remote: 10:05:23.068 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:51) remote: 10:05:23.068 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.ShortCircuitEmptyScriptCompiler.compile(ShortCircuitEmptyScriptCompiler.java:35) remote: 10:05:23.069 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.CachingScriptClassCompiler.compile(CachingScriptClassCompiler.java:36) remote: 10:05:23.069 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:60) remote: 10:05:23.070 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:118) remote: 10:05:23.070 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38) remote: 10:05:23.071 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25) remote: 10:05:23.102 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34) remote: 10:05:23.102 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55) remote: 10:05:23.103 [ERROR] [org.gradle.BuildExceptionReporter] … 25 more remote: 10:05:23.103 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.internal.UncheckedException: java.net.BindException: Permission denied remote: 10:05:23.103 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39) remote: 10:05:23.104 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.FileLockCommunicator.(FileLockCommunicator.java:38) remote: 10:05:23.104 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler.reservePort(DefaultFileLockContentionHandler.java:149) remote: 10:05:23.105 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:90) remote: 10:05:23.107 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:78) remote: 10:05:23.108 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:88) remote: 10:05:23.110 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:45) remote: 10:05:23.111 [ERROR] [org.gradle.BuildExceptionReporter] … 40 more remote: 10:05:23.113 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.net.BindException: Permission denied remote: 10:05:23.115 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.FileLockCommunicator.(FileLockCommunicator.java:36) remote: 10:05:23.116 [ERROR] [org.gradle.BuildExceptionReporter] … 45 more remote: 10:05:23.118 [ERROR] [org.gradle.BuildExceptionReporter]

remote: 10:05:23.119 [LIFECYCLE] [org.gradle.BuildResultLogger]

remote: 10:05:23.121 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED remote: 10:05:23.123 [LIFECYCLE] [org.gradle.BuildResultLogger]

remote: 10:05:23.1


(Peter Niederwieser) #2

Looks like a problem related to the network configuration of the box that’s running the build (or the permissions of the Gradle process). Apparently it’s not possible to open a local UDP socket.


(Shekhar Gulati) #3

Hello Peter,

I looked at Gradle source code and exception is coming at this line https://github.com/gradle/gradle/blob/f7d937f981e8a84a05af0bf0520770d5b375beda/subprojects/core/src/main/groovy/org/gradle/cache/internal/FileLockCommunicator.java#L37 . This class did not exist in Gradle 1.6. In that line you are creating an instance of DatagramSocket. As you are not specifying any host or port it will arbitrary use any port number and probably use 0.0.0.0 as Ip address. This does not work in OpenShift as you can only bind to $OPENSHIFT_INTERNAL_IP and ports between 15000 to 65535. Is it feasible that I can override these values?

Thanks Shekhar


(Peter Niederwieser) #4

Thanks for the explanation. I’ve created GRADLE-2871 to track this.