aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server/.project
diff options
context:
space:
mode:
authorMartin Fick <mfick@nvidia.com>2024-12-11 17:00:17 -0800
committerMartin Fick <mfick@nvidia.com>2024-12-13 01:20:49 +0000
commitae53d63837857d886cdf15442118597be717ff33 (patch)
treef3fde1052bd707735e6a30e12eec0af97eff5fe6 /org.eclipse.jgit.lfs.server/.project
parentd2ff398bcbd0177200651f684920b513a923ab82 (diff)
downloadjgit-ae53d63837857d886cdf15442118597be717ff33.tar.gz
jgit-ae53d63837857d886cdf15442118597be717ff33.zip
Pack: fix threading bug getting idx
When converting to Optionally, a threading bug was introduced, fix it. The Optionally class itself is not thread safe, and previously it was being called from idx() without any thread synchronization mechanism. This was because previously the variable which held the cached index was volatile. The Optionally<PackIndex> kept the volatile attribute, but that only synchronizes the reference to the Optionally, and not the element inside the Optionally. A clear() from another thread could thus be missed by the idx() call, potentially allowing the idx() call to interact poorly with the Optionally, potentially even causing a memory leak. To fix this, extend the synchronized inside the idx() method to the entire method. Then, additionally remove the now redundant Optional fetch in idx() and the no longer needed volatile. Change-Id: I6077e1aaed96c53200805b4c87a67afb49c2b373 Signed-off-by: Martin Fick <mfick@nvidia.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server/.project')
0 files changed, 0 insertions, 0 deletions