sync: Fix locking problems during merge when annex.pidlock is set
authorJoey Hess <joeyh@joeyh.name>
Mon, 4 Dec 2023 17:37:58 +0000 (13:37 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 4 Dec 2023 17:40:28 +0000 (13:40 -0400)
commit0485dd3161364e61da70cd276b18e45ede4e364c
tree886dfc0d14ad661e8ab5107e2fac65be96e2fb47
parent37ff9b6401c41095f9c5cb565aaba5efeeae741b
sync: Fix locking problems during merge when annex.pidlock is set

Presumably git merge sometimes needs to verifiy if a worktree file is
modified, and so will then run git-annex filter-process which would try to
take the pid lock. And for whatever reason, git-annex sync already had the
pidlock held. I have not replicated that, but it does make enough sense to
deploy the workaround.

Like I said back in commit 7bdb0cdc0d6f35d3835e57c3a34740cc98f89719,

   Arguably, it would be better to have a way to make any process git-annex
   runs have the env var set. But then it would need to take the pid lock
   when running any and all processes, and that would be a problem when
   git-annex runs two processes concurrently. So, I'm left doing it ad-hoc
   in places where git-annex really does run a child process, directly
   or indirectly via a particular git command.

Sponsored-by: KDM on Patreon
CHANGELOG
Command/Sync.hs
doc/bugs/Race_condition_or_double-locking_with_pidlock.mdwn
doc/bugs/Race_condition_or_double-locking_with_pidlock/comment_1_bd92615c640ff017cd8a2ebfcc117a37._comment [new file with mode: 0644]