Hello.
I'm working on a spring boot project that uses jgit (version 6.1.0.202203080745-r) to fetch remote repo to a local network dir inside a Kubernetes environment.
We have many pods where we implement our API.
We are seeing some errors in the JGit-WorkQueue thread like this:
Exception caught while accessing pack file /.../objects/pack/pack-db627c1a19af5a52f2f17c1934f89e4c894f3073.pack, the pack file might be corrupt. Caught 1 consecutive errors while trying to read this pack.
Investigating the issues and watching the entire stack trace I've discovered that this is not happening on our code and it is basically the GC that sometimes is triggered by jgit while other pods are accessing the repo.
So I've tried to totally disable the auto gc initializing with git a file in /etc/gitconfig like this:
[gc]
auto = 0
autoPackLimit = 0
autoDetach = false
using the following command in the Dockerfile:
RUN (git config --system gc.auto 0 && git config --system gc.autoPackLimit 0 && git config --system gc.autoDetach false)
Anyway, I still see this error each 3 hr more or less.
I've even tried to inizilize jgit using a code like this in the bean that implements git operations:
private void loadConfig() {
SystemReader configReader = SystemReader.getInstance();
try {
StoredConfig systemConfig = configReader.getSystemConfig();
log.info("loading jgit system config: {}", systemConfig);
systemConfig.load();
}
catch (IOException | ConfigInvalidException e) {
log.error("error while loading jgit system config", e);
}
try {
StoredConfig userConfig = configReader.getUserConfig();
log.info("loading jgit user config: {}", userConfig);
userConfig.load();
}
catch (IOException | ConfigInvalidException e) {
log.error("error while loading jgit user config", e);
}
}
the log shows that effectively the configuration is loaded.
Can someone help me to troubleshoot this?
Is there any way to use the fetch command disabling autogc?
Em I missing something:?
PS
We have a cronjob that does the GC on each repository so we basically do not need autogc even because the autogc does not lock the repo to avoid concurrent access tries.