# HG changeset patch # User Yuya Nishihara # Date 1479384538 -32400 # Node ID f2d13eb8519886f86a312467ca411e47f6998497 # Parent 237b2883cbd86478c3b073de0e3dbee7ebdf7239 worker: kill workers after all zombie processes are reaped Since we now wait child processes in non-blocking way (changed by 7bc25549e084 and e8fb03cfbbde), we don't have to kill them in the middle of the waitpid() loop. This change will help solving a possible race of waitpid()-pids.discard() sequence and another SIGCHLD. waitforworkers() is called by cleanup(), in which case we do killworkers() beforehand so we can remove killworkers() from waitforworkers(). diff -r 237b2883cbd8 -r f2d13eb85198 mercurial/worker.py --- a/mercurial/worker.py Thu Nov 17 20:44:05 2016 +0900 +++ b/mercurial/worker.py Thu Nov 17 21:08:58 2016 +0900 @@ -119,9 +119,10 @@ st = _exitstatus(st) if st and not problem[0]: problem[0] = st - killworkers() def sigchldhandler(signum, frame): waitforworkers(blocking=False) + if problem[0]: + killworkers() oldchldhandler = signal.signal(signal.SIGCHLD, sigchldhandler) for pargs in partition(args, workers): pid = os.fork()