Open NorbertSandor opened 2 years ago
I did some debug try to analyze what happended.
In the KotlinCompileDaemon process, the java.util.zip.ZipFile.Source
doesn't close the underlying RandomAccessFile
that in zfile
field. After a GC(I trigger it on visualvm), the problem solved.
So, should we call System.gc
after build?
I guess the ZipFile.Source is used by JVM self.
@iseki0 sorry, I somehow missed your valuable comment... Maybe could you please file the issue in the JDK issue tracker?
The problem is still present in Java 17 (I tried with KSP 1.8.21-1.0.11).
@iseki0 sorry, I somehow missed your valuable comment... Maybe could you please file the issue in the JDK issue tracker?
The problem is still present in Java 17 (I tried with KSP 1.8.21-1.0.11).
I will do this, even I can't find a solution.
As a workaround, I still (reguraly) use gradlew --stop
to stop the Gradle daemons when this problem arise...
I use KSP in a multi-platform multi-module project with Idea CE. (But currently KSP is applied only on one JVM project.) The processor implementation is in a separate project (
project-processor
), and it depends on another local project (project-annotations
) containing the annotation class triggering my processor to be applied. When I try to build or clean the whole project, I often run into that the JAR file ofproject-annotations
is locked and therefore cannot be deleted. After I stop all Gradle daemons usinggradlew --stop
and retry the build/clean then it always succeeds. So it seems that the build artifact ofproject-annotations
is locked by a Gradle daemon(s) which executed my processor fromproject-processor
- and not only during the build but for longer term. (I use Kotlin 1.7.10 and the latest compatible KSP plugin.)Unable to delete directory '...\project-annotations\build' Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
Discussion: https://kotlinlang.slack.com/archives/C013BA8EQSE/p1657567571507389
I use Windows 11 and as someone noted this issue is probably present only on Windows.