Build fails with java.io.FileNotFoundException


(Alex Dubrouski) #1

Good morning,

Few months ago we started facing issues fetching artifacts from Nexus. Builds of different applications and libraries randomly fail on Jenkins only (local dev envs are not affected) with this error. The most important is that it seems to be caching this name and will continue to fail on next attempt

 Caused by: org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /tmp/gradle_download7040722318908793119bin (No such file or directory)
 	at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:45)
 	at org.gradle.internal.resource.local.GroupedAndNamedUniqueFileStore.getChecksum(GroupedAndNamedUniqueFileStore.java:64)
 	at org.gradle.internal.resource.local.GroupedAndNamedUniqueFileStore.move(GroupedAndNamedUniqueFileStore.java:45)
 	at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver$1.moveIntoCache(DefaultExternalResourceArtifactResolver.java:99)
 	at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$3.create(DefaultCacheAwareExternalResourceAccessor.java:214)
 	at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$3.create(DefaultCacheAwareExternalResourceAccessor.java:212)
 	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:189)
 	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
 	at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:194)
 	at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:60)
 	at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.moveIntoCache(DefaultCacheAwareExternalResourceAccessor.java:212)
 	at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:205)
 	at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:82)
 	at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:97)

tmp file is always random, but failures mostly caused by huge artifacts (>300MB size)
Java 1.8
Debian 7/8
Gradle 3.5
Gradle start options “–no-daemon --no-build-cache --stacktrace --parallel”, Jenkins wipes whole workspace before builds, so no project cache
The only workaround I found so far is to login to jenkins server and run build in workspace manually, it looks like it resets some cache, it downloads artifacts and then Jenkins is able to move on