question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Randomly failing maven build with WindowsException

See original GitHub issue

Description of the issue: From time to time I get the following exception failing the build. It seems Windows related with some cache access error. The root exception I get is AccessDeniedException based on some WindowsExceptions. It happens quite often when the build runs through very fast. When I’m on battery with my laptop (slower CPU freq) the error doesn’t occur. Could this also be due to some concurrency in jib during the build?

Caused by: java.nio.file.AccessDeniedException: C:\Users\I506803\examples\personservice\target\jib-cache\tmp\4235202945488612732 -> C:\Users\I506803\examples\personservice\target\jib-cache\layers\b4617547f616e55fb347a9d4cf7db25dc27bf11608a4e6ef749c13df3334538b
    at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:97)
    at sun.nio.fs.WindowsFileCopy.move (WindowsFileCopy.java:387)
    at sun.nio.fs.WindowsFileSystemProvider.move (WindowsFileSystemProvider.java:287)
    at java.nio.file.Files.move (Files.java:1395)
    at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.moveIfDoesNotExist (DefaultCacheStorageWriter.java:74)
    at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.write (DefaultCacheStorageWriter.java:184)
    at com.google.cloud.tools.jib.cache.DefaultCacheStorage.write (DefaultCacheStorage.java:69)
    at com.google.cloud.tools.jib.cache.Cache.writeUncompressedLayer (Cache.java:82)
    at com.google.cloud.tools.jib.builder.steps.BuildAndCacheApplicationLayerStep.call (BuildAndCacheApplicationLayerStep.java:138)
    at com.google.cloud.tools.jib.builder.steps.BuildAndCacheApplicationLayerStep.call (BuildAndCacheApplicationLayerStep.java:40)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:57)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Steps to reproduce: Build container on Windows. Still hard to reproduce since the bug occurs randomly.

Environment: jib-maven-plugin 1.0.2, Windows 10

jib-maven-plugin Configuration:

<plugin>
	<groupId>com.google.cloud.tools</groupId>
	<artifactId>jib-maven-plugin</artifactId>
	<version>${jib.version}</version>
	<configuration>
		<to>
			<image>registry.hub.docker.com/${docker.repositoryname}/mongokubernetes:${project.version}</image>
			<credHelper>${jib.credentialhelper}</credHelper>
		</to>
	</configuration>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>build</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
adelinorcommented, Feb 8, 2021

@chanseokoh ,

  • Yes indeed with version 2.7.1. To be more precise I was on version 2.6.0 until I got 3 consecutive build failures because of the AccessDeniedException. I upgraded but it was the same issue still.
  • I set the path under the c drive where I keep tooling caches such as the local maven repo
  • I can’t turn off the antivirus as I do not have rights 😦
  • the new location is potentially not treated the same by the antivirus software
1reaction
chanseokohcommented, Aug 24, 2022

I don’t think this is a concurrency issue, if you are not running multiple Jib builds in parallel or building a multi-module project. There was a similar case before (#1438), and the cause was an anti-virus software. Make sure you close any file explorer (from my experience, if you have ever opened a folder in an explorer, then even if you close and navigate away from the folder, I’ve seen cases where you cannot delete the folder until you close the explorer) and any command line windows, and disable anti-virus.

For further testing, you can do mvn -Djib.serialize=true ... to run a build serially. You can also use -Djib.applicationCache=... to use a different application cache directory than target/jib-cache (https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#system-properties).


UPDATE: if the problematic directory is not an application cache directory (cache for your single project) but the central base image cache shared across Jib projects on the same machine (like in #3740), you’d try -Djib.baseImageCache=... instead of -Djib.applicationCache=... for testing. However, remember that this is changing the shared cache, so if you decide to do this for a short-term solution, you’ll want to set this for all Jib runs across projects to benefit the cache.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven compile sometimes fail and sometimes succeed
I use maven clear and then compile, and I got Compilation failure. Then when I try maven compile several seconds later, it build...
Read more >
Maven Failsafe Plugin – Skipping Tests After Failure
To skip remaining tests after first failure or error has happened set configuration parameter skipAfterFailureCount to 1 .
Read more >
Random build failures using maven 3 (multi-thread) + bamboo
Big project with many maven modules. We're experiencing random build failures, eg: ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.0.
Read more >
Camunda Check If Variable Exists
Mastering Excel Advanced Package - Episode 1: Build a Profit Calculation Bot. One big problem we are having is we are using Windows...
Read more >
Why Your JUnit 5 Tests Are Not Running Under Maven
At the time of writing, their base Docker build image is running an older version of Maven. (thus your JUnit 5 tests will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found