Abort: cannot lock repository when using hg serve on low‑traffic deployments
0 reputation · 11 Jan 2023, 16:30 UTC
Goal
Reduce I/O and CPU costs for a Mercurial repository that receives very few requests per day.
Constraint
Mercurial protects its store with a lockfile located at .hg/store/lock. When hg serve spawns multiple worker threads, each thread may attempt to acquire this lock even for read‑only operations, potentially triggering the documented error abort: cannot lock repository.
Unresolved Decision
The official guides do not prescribe default values for --workers or --timeout in hg serve. Choosing the optimal thread count and request timeout for a low‑traffic scenario remains an open tuning question, directly affecting lock contention and cost.
Questions
- What minimal worker count for
hg servebalances cost savings and avoids lock contention on a repository with fewer than one commit per day? - Does the
--timeoutsetting influence how often thecannot lock repositoryerror occurs, and what default would be appropriate for low‑traffic use? - Is there an official or community recommendation for disabling the lockfile in read‑only
hg serveinstances to reduce I/O overhead?