Timeout waiting to lock artifact cache (/path/to/.gradle/caches/modules-2). It is currently in use by another Gradle instance

Matt picture Matt · Nov 27, 2016 · Viewed 11k times · Source

Not sure if this question is for stackoverflow or superuser

EDIT: superuser doesn't even have a gradle tag, so I'm guessing this is for stackoverflow

Hi i am trying to run ./mach gradle app:test to test bug fixes in mozillas code

When I run it I get this error

Timeout waiting to lock artifact cache (/home/user/.gradle/caches/modules-2). It is currently in use by another Gradle instance.

I get the same error when running ./mach gradle app:checkstyle so I assume I would get this with and gradle command

I've checked to see what daemons where running with service --status-all but there i nothing there with the word gradle in it

The other questions I've looked at had answers that say to run gradle --stop to check if daemons are running. When I run that command it says Stopping daemon(s) and hangs

How can I fix this? I have tried closing and re-opening the terminal.

Answer

Bill picture Bill · May 18, 2018

Error message

* What went wrong:
> Could not resolve all dependencies for configuration ':runtime'.
   > Timeout waiting to lock artifact cache (\Users\username\.gradle\caches\modules-2). It is currently in use by another Gradle instance.
     Owner PID: 10736
     Our PID: 204
     Owner Operation: resolve configuration ':classpath'
     Our operation:
     Lock file: \Users\username\.gradle\caches\modules-2\modules-2.lock

* Try:
Run with --info or --debug option to get more log output.

it's occours when you terminate gradle build task by Ctrl+C or Crtl+Z .

rm your_path/modules-2.lock