jgit/org.eclipse.jgit
Thomas Wolf 0f078da4e4 FileBasedConfig: in-process synchronization for load() and save()
On Windows reading and replacing a file via renaming concurrently may
fail either in the reader or in the thread renaming the file. For
renaming, FileUtils.rename() has a last-case fallback in which it
deletes the target file before attempting the rename. If a reader reads
at that moment, it will produce an empty config, and the snapshot and
hash may be wrong because the concurrently running save() may set them.

It's not really possible to do all this in a thread-safe manner without
some synchronization. Add a read-write lock to synchronize readers and
writers to avoid at least that JGit steps on its own feet.

Bug: 451508
Change-Id: I7e5f0f26e02f34ba02dc925a445044d3e21389b4
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-10-14 23:33:11 +02:00
..
.settings Merge branch 'stable-6.2' into stable-6.3 2023-10-13 01:31:01 +02:00
META-INF Use ShutdownHook to gracefully handle JVM shutdown 2023-09-12 22:43:15 +02:00
OSGI-INF/l10n OSGi: move plugin localization to subdirectory 2023-09-12 20:27:59 +02:00
findBugs [spotbugs] Silence NP_BOOLEAN_RETURN_NULL in IgnoreNode#checkIgnored 2020-12-22 10:52:59 +01:00
resources/org/eclipse/jgit DeleteBranchCommand: update config only at the end 2023-10-14 23:33:11 +02:00
src/org/eclipse/jgit FileBasedConfig: in-process synchronization for load() and save() 2023-10-14 23:33:11 +02:00
.classpath Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
.fbprefs
.gitignore
.project
BUILD CommitGraphWriter: write changed-path filters 2023-07-18 14:21:48 -07:00
about.html SHA-1: collision detection support 2017-02-28 16:38:43 -08:00
build.properties OSGi: move plugin localization to subdirectory 2023-09-12 20:27:59 +02:00
pom.xml Prepare 6.8.0-SNAPSHOT builds 2023-09-07 02:24:53 +02:00