rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Bazel user root dir can grow unbound due to stale artifacts downloaded by rules_jvm_external

Open nkoroste opened this issue 3 years ago • 1 comments

I noticed that the Bazel user root dir grows unbound because rules_jvm_external keeps stale version of the downloaded artifacts unless I manually run bazel clean --expunge to clean it up.

My expectation is to only have 1 version of a specific library to be present as defined in the WORKSPACE, specially if pinning is used.

For example, I'm only using 3_12_4 but I 3 different versions present:

_bazel_root/<Some SHA>/external/com_google_protobuf_protobuf_java_3_10_0
_bazel_root/<Some SHA>/external/com_google_protobuf_protobuf_java_3_11_0
_bazel_root/<Some SHA>/external/com_google_protobuf_protobuf_java_3_12_4

may be related to some of the issues reported on https://github.com/bazelbuild/bazel/issues/5139

nkoroste avatar May 17 '21 22:05 nkoroste

This is definitely a cache management issue on the Bazel side, but you'll only hit this issue if you use maven_install.json. With artifact pinning, RJE maps each artifact to its own repo internally to take advantage of bazel's downloader and repo cache, with doesn't do cache invalidation of older downloaded artifacts.

If you don't use maven_install.json, any change to the @maven list of artifacts will cause a full clean re-download of all artifacts.

jin avatar Oct 14 '21 23:10 jin