groovy Gradle守护程序因文件锁定超时而停止并行工作

up9lanfz  于 2022-11-01  发布在  其他
关注(0)|答案(2)|浏览(259)

昨天,突然之间,我在Windows 10机器上的项目由于文件锁定超时而停止了并行运行。
我的所有项目都使用gradle-wrapper并提供run任务
当我启动第一个运行任务时,它正常工作,但任何后续运行任务都因如下错误而中断:

> .\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

--status选项显示:

> .\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)

我尝试了不同的技巧,如切换Gradle版本5.6.1 - 6.8.3 - 6.9.1和使用--stop选项,但错误仍然存在。
--stacktrace添加到run命令后,不仅会涉及journal-1缓存,还会涉及其他目录,如modules-2
我没有对我的系统做任何改变,除了定期的Win10更新。
如何解决此问题?
短暂性脑缺血

dohp0rv5

dohp0rv51#

很可能是gradle进程异常退出并留下了锁文件。检查任务管理器中是否存在ID为16440的进程,如果不存在,则删除孤立锁文件C:\Users\injec\.gradle\caches\journal-1\journal-1.lock

whlutmcx

whlutmcx2#

这可能是C:\Users\injec\.gradle的文件系统权限......而您可能已经看到了一个细节:您正在调用.\gradlew而不是./gradlewgradlew.bat ...这意味着您不是在CMD上运行,而是在PS或WSL上运行。gradlew.bat run将直接在CMD上运行。

相关问题