Bug 579445 - slow FS cause warning when locking jgit config
Summary: slow FS cause warning when locking jgit config
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 5.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 6.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL: https://git.eclipse.org/r/c/jgit/jgit...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-28 05:22 EDT by James Gao CLA
Modified: 2022-05-27 10:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Gao CLA 2022-03-28 05:22:24 EDT
When the FS is somewhat slow (such as overlay fs in docker), the git commit maven plugin (using jgit) almost always produces the following warning:

> [WARNING] locking FileBasedConfig[/root/.config/jgit/config] failed after 5 retries

If mount the /root/.config to a host volume, the warning disappears.
Comment 1 Thomas Wolf CLA 2022-03-28 06:31:55 EDT
What does "somewhat slow" mean?
Comment 2 James Gao CLA 2022-03-28 07:03:15 EDT
$HOME is on a overlay fs in a docker container.
Comment 3 Thomas Wolf CLA 2022-03-28 07:06:40 EDT
Yes, I got that. But what does slow mean? How much slower is the overlay FS than a direct mount of a host volume (Relative and absolute)? Say, for writing 2kB? What is the file timestamp resolution? The same or different?
Comment 4 James Gao CLA 2022-04-06 03:13:42 EDT
Hi, after some testing, it can be reproduced that when the xdg config home is on a overlay2 volume in docker container, the `LockFile::commit` seems not work well, the ~/.config/jgit/config is not shown and the ~/.config/jgit/config.lock is left with correct snapshot content. Then the following run will failed to save config again.
Comment 5 James Gao CLA 2022-04-06 03:48:34 EDT
another condition to reproduce: the git dir is on a host volume and the xdg config dir is on a overlayfs.
Comment 6 James Gao CLA 2022-04-07 04:15:13 EDT
when run in docker, the `measureMinimalRacyInterval` is executed twice for .git dir and ~/.config/jgit/config. Each time `measureMinimalRacyInterval` method has to loop for a fixed 3 seconds. Then if the program run between 3 to 6 seconds, the JVM shut down while `measureMinimalRacyInterval(~/.config/jgit/config)` is still working, resulting the ~/.config/jgit/{config.lock, .probe-UUID} files not clean up.

The left .probe-UUID is ok, just some 0~1 byte small files. But config.lock blocks the following executions.
Comment 7 James Gao CLA 2022-04-07 09:38:12 EDT
can we add an api to `interrupt()` and `join()` the threads in FUTURE_RUNNER and SAVE_RUNNER? then we can cleanup the pending probe and lock files.
Comment 9 James Gao CLA 2022-05-15 21:48:38 EDT
@Thomas to apply the patch to 5.x branch, need I create another Gerrit review based on branch stable-5.13? Or push to each branch with SAVE_RUNNER: stable-5.9, stable-5.10, stable-5.11, stable-5.12, stable-5.13, stable-6.0, stable-6.1, stable-6.2?
Comment 10 James Gao CLA 2022-05-15 21:59:15 EDT
from the merging history in the repo, it seems that we only need to cherry-pick the patch to stable-5.9, is it correct?
Comment 11 Eclipse Genie CLA 2022-05-15 22:31:55 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/193379