New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing `cache.properties` file causes Gradle to fail to start #3176

Closed
big-guy opened this Issue Oct 12, 2017 · 6 comments

Comments

Projects
None yet
7 participants
@big-guy
Member

big-guy commented Oct 12, 2017

Sporadically, starting with Gradle 4.2, the file .gradle/buildOutputCleanup/cache.properties is removed or fails to be created when starting the Gradle daemon. This causes the build to fail very early (while creating TaskExecutionServices) and is unrecoverable without deleting the .gradle directory or creating the missing file by hand. Stopping and restarting the daemon doesn't recreate the file.

This doesn't appear to happen on every build and I believe the build sometimes works and then fails later (with another new daemon).

Expected Behavior

Gradle would not fail to start.

Current Behavior

Gradle fails with a cryptic message:

Could not create service of type TaskOutputFilesRepository using TaskExecutionServices.createTaskOutputFilesRepository(). 
> java.io.FileNotFoundException: /path/to/project/.gradle/buildOutputCleanup/cache.properties (No such file or directory)

Context

I can provide more context privately.

Steps to Reproduce (for bugs)

This happens sporadically.

Your Environment

The build is running inside a Linux Docker container.

This occurs on Gradle 4.2. Previously, the project was using 4.0.2 and didn't see this problem.

@blindpirate

This comment has been minimized.

Member

blindpirate commented Oct 16, 2017

The failure occurs here, where Gradle tries to load cache.properties. It's easy to reproduce, just remove .gradle/buildOutputCleanup/cache.properties and rerun any gradle task. However, I tried both 4.2.1 and 4.0.2 and they both see this issue. So the question is: when and where is it removed in 4.2.1? I couldn't find out any clues in code, @big-guy please give me more context privately.

blindpirate added a commit that referenced this issue Oct 17, 2017

Check validity of .gradle/buildOutputCleanup/cache.properties
This is an attempt to fix #3176 .

When .gradle/buildOutputCleanup/cache.properties is removed unexpectedly,
Gradle will fail to start. This PR adds a safe-check before accessing the file.

blindpirate added a commit that referenced this issue Oct 17, 2017

Check validity of .gradle/buildOutputCleanup/cache.properties
This is an attempt to fix #3176 .

When .gradle/buildOutputCleanup/cache.properties is removed unexpectedly,
Gradle will fail to start. This PR adds a safe-check before accessing the file.

blindpirate added a commit that referenced this issue Nov 2, 2017

Check validity of .gradle/buildOutputCleanup/cache.properties
This is an attempt to fix #3176 .

When .gradle/buildOutputCleanup/cache.properties is removed unexpectedly,
Gradle will fail to start. This PR adds a safe-check before accessing the file.

@big-guy big-guy closed this in #3211 Nov 2, 2017

@npappassl

This comment has been minimized.

npappassl commented Jan 11, 2018

Removing the cache.properties.lock file did the trick for me

@melanke

This comment has been minimized.

melanke commented Jul 25, 2018

Or removing buildOutputCleanup.lock

@FauricioValencia

This comment has been minimized.

FauricioValencia commented Aug 15, 2018

las rutas??

@esipavicius

This comment has been minimized.

esipavicius commented Aug 25, 2018

With ubuntu I start react-native run-android with sudo. So its gets permissions to download .gradle. Maybe its works when chmod .gradle folder.

@backdoorcodr

This comment has been minimized.

backdoorcodr commented Oct 8, 2018

or by removing the workerMain.lock !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment