# HG changeset patch # User Yuya Nishihara # Date 1479383829 -32400 # Node ID 03f7aa2bd0e3129f4cb05de09b25e726dc252a4c # Parent f2d13eb8519886f86a312467ca411e47f6998497 worker: discard waited pid by anyone who noticed it first This makes sure all waited pids are removed before calling killworkers() even if waitpid()-pids.discard() sequence is interrupted by another SIGCHLD. diff -r f2d13eb85198 -r 03f7aa2bd0e3 mercurial/worker.py --- a/mercurial/worker.py Thu Nov 17 21:08:58 2016 +0900 +++ b/mercurial/worker.py Thu Nov 17 20:57:09 2016 +0900 @@ -111,11 +111,14 @@ if e.errno == errno.EINTR: continue elif e.errno == errno.ECHILD: - break # ignore ECHILD + # child would already be reaped, but pids yet been + # updated (maybe interrupted just after waitpid) + pids.discard(pid) + break else: raise if p: - pids.remove(p) + pids.discard(p) st = _exitstatus(st) if st and not problem[0]: problem[0] = st