Skip to content
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 · Fixed by #3211
Closed

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

big-guy opened this issue Oct 12, 2017 · 6 comments · Fixed by #3211

Comments

@big-guy
Copy link
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
Copy link
Collaborator

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
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
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.
@npappassl
Copy link

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

@melanke
Copy link

melanke commented Jul 25, 2018

Or removing buildOutputCleanup.lock

@FauricioValencia
Copy link

las rutas??

@esipavicius
Copy link

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
Copy link

or by removing the workerMain.lock !

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

Successfully merging a pull request may close this issue.

7 participants