j2cl icon indicating copy to clipboard operation
j2cl copied to clipboard

J2CL leaves a lot of temporary directories (when using long-lived processes)

Open tbroyer opened this issue 3 years ago • 0 comments

I'm sure this has been brought up before, but I can't find anything here, so opening as a tracking issue.

Describe the bug J2CL tools (GwtIncompatibleStripper, J2clTranspiler, and probably others) create temporary directories where they copy sources / expand source JARs to, and never clean them up. In case of JVM crash or abrupt termination (SIGKILL), the JVM won't clean them up either; but probably more importantly, with long-lived processes and many runs (including ibazel with Bazel workers), the number of temporary directories (and their temporary subdirs and files) grow and grow and grow… until eventually the process is terminated.

To Reproduce Run ibazel and watch your ls -d /tmp/*/j2cl_sources/ |wc -l grow as you edit files and ibazel reruns targets.

The j2cl-maven-plugin's "watch" goal will behave similarly.

As well as Gradle's J2CL plugin, which makes use of workers similar to Bazel (and Gradle also using a daemon outliving the build); exacerbated by Gradle's continuous build (similar to ibazel).

Bazel version Please include version of Bazel that you are running J2CL with:

$ bazel version
Bazelisk version: v1.5.0
Starting local Bazel server and connecting to it...
Build label: 3.3.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Jun 17 12:55:32 2020 (1592398532)
Build timestamp: 1592398532
Build timestamp as int: 1592398532

Expected behavior Ideally, the temporary directory should be cleaned up after the tool did its job, without waiting for the JVM shutdown.

tbroyer avatar Jul 28 '20 17:07 tbroyer