Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 746
injecteer Avatar asked Jan 22 '26 11:01

injecteer


2 Answers

It's likely that gradle process was exited abnormally and left the lock file behind. Check in the task manager if process with id 16440 exists, and if not just remove the orphan lock file C:\Users\injec\.gradle\caches\journal-1\journal-1.lock

like image 107
kofemann Avatar answered Jan 24 '26 11:01

kofemann


This may be the file-system permissions of C:\Users\injec\.gradle... while you may have overseen one detail: you're calling .\gradlew instead of ./gradlew or gradlew.bat ...which means that you are not running on CMD, but on PS or WSL. gradlew.bat run would run directly on CMD.

like image 28
Martin Zeitler Avatar answered Jan 24 '26 11:01

Martin Zeitler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!