sapling/hgext/fastmanifest
Jun Wu 9740116626 lock: use flock on POSIX
Summary:
We recently ran into issues with locks in pid namespaces [1]. Let's fix that
by using flock.

flock is more reliable in Linux's pid namespace use-case than file-existence
test, because it works without a /proc filesystem and does not have deadlock
issue if an hg process is killed unexpectedly (ex. OOM or SIGKILL).

The transition should be transparent:
- If the new code saw a symlink lock file generated by the old code.
  `open(..., O_NOFOLLOW)` will fail and it's considered lock taken by the old
  process correctly.
- If the old code saw a new lock file. It will treat it as system without
  symlink support and it's considered lock taken by the new process correctly.

A non-symlink stale lock (regardless of whether it contains pid information or not)
will be confidently removed automatically by the new code.

The change is complicated because it works when both new and old hg
run at the same time. If we have migrated most users to the new code path,
the code can be cleaned up significantly.

[1]: https://fburl.com/85fxjisi

Reviewed By: DurhamG

Differential Revision: D9004614

fbshipit-source-id: d501c4f3a7bc8ad73c9556be1c6a265ffd0d0686
2018-08-08 16:20:21 -07:00
..
__init__.py fastmanifest: drop global uiproxy 2018-06-28 14:20:41 -07:00
cachemanager.py codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00
concurrency.py lock: use flock on POSIX 2018-08-08 16:20:21 -07:00
constants.py codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00
debug.py Upgrade to 18.5b1 2018-05-30 02:23:58 -07:00
implementation.py fastmanifest: switch to using manifestlog.ui where possible 2018-07-15 10:03:33 -07:00
metrics.py codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00