[PATCH 1 of 2 STABLE] worker: be silent if killed by the main process
Yuya Nishihara
yuya at tcha.org
Sun Apr 23 10:56:13 UTC 2017
On Sat, 22 Apr 2017 17:20:14 -0700, Jun Wu wrote:
> Excerpts from Jun Wu's message of 2017-04-22 13:54:50 -0700:
> > > I finally get it. tl;dr I prefer moving SignalInterrupt to dispatch.py
> > > and will do that.
> >
> > But I suspect if that works. Since the signal could arrive before the main
> > "try" block in the worker process. "killed!" may still be printed because
> > it's caught by dispatch.py and the worker "try except" code is not executed
> > yet.
> >
> > I also think the current worker code could escape the "always os._exit"
> > assumption if a signal hits before "try".
>
> FWIW, I had a fix ready: https://bpaste.net/show/2dbbed3fa647 which I think
> is the most correct way to fix all issues discovered in this thread. It does
> not use SIGUSR2. I'll send them after freeze.
These look good to me, thanks. I think the first patch is simple enough to
include in stable if that helps solving the CI issue.
A few nits:
- pid could be initialized to a null value instead of comparing to parentpid
pid = -1
try:
pid = os.fork()
...
finally:
if pid == 0:
os._exit()
- BaseException can be used to catch any exception object
More information about the Mercurial-devel
mailing list