Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a pidfile race in server_write_pid()
During the brief interval between a server creating its pidfile and locking it, the pidfile could be removed by another process that detected it as stale. This caused a non-deterministic failure of the server/StartTwice test case. To fix this race, the server now creates and locks a temporary pidfile which it then hard-links to the real pidfile, guaranteeing that the pidfile is already locked in the instant that it appears. This means that an unlocked pidfile is guaranteed to be stale, not just in the process of creation, so can be safely unlinked by any other process.
- Loading branch information
1 parent
192fefd
commit 94c58e8
Showing
1 changed file
with
125 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters