Search code examples
javagradlegroovydaemon

Gradle Daemon stopped working in parallel due to file lock timeouts


Yesterday all of the sudden my projects on a Windows 10 machine stopped running in parallel due to file lock timeouts.

All my projects are using gradle-wrapper and provide a run task

When I start the 1st run-task, it work normally, but any following run-tasks break with the error like this:

> .\gradlew run
Starting a Gradle Daemon, 1 busy and 4 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Gradle could not start your build.
> Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().
   > Timeout waiting to lock journal cache (C:\Users\injec\.gradle\caches\journal-1). It is currently in use by another Gradle instance.
     Owner PID: 16440
     Our PID: 12216
     Owner Operation:
     Our operation:
     Lock file: C:\Users\injec\.gradle\caches\journal-1\journal-1.lock

the --status option shows:

> .\gradlew --status
   PID STATUS   INFO
 12216 IDLE     6.9.1
 16440 BUSY     6.9.1
 14992 STOPPED  (stop command received)
  7856 STOPPED  (other compatible daemons were started and after being idle for 0 minutes and not recently used)
 26680 STOPPED  (by user or operating system)
 18556 STOPPED  (by user or operating system)

I tried different tricks, like switching the Gradle verison 5.6.1 - 6.8.3 - 6.9.1 and using the --stop option, but the error remains.

Adding the --stacktrace to the run command reveals that not only journal-1 cache is involved, but also some others dirs like modules-2.

I didn't do any changes to my system, apart from regular Win10 updates.

How can the problem be fixed?

TIA


Solution

  • See the My comment in a thread and the rest of discussion.

    On my Win11-box I needed to add an exclusion to Antivirus on C:\Users.gradle\caches folder to make Gradle run normal again.

    Hope this will help someone...