[PATCH 1 of 2 STABLE] worker: be silent if killed by the main process

Jun Wu quark at fb.com
Sat Apr 22 20:20:14 EDT 2017


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.
 
> So it seems we want to set a global exception handler before calling
> os.fork(). I'll do that instead.
> 
> > The two approaches only differ in the case where a manual SIGTERM hits a
> > worker, the SIGUSR2 way will print "killed!" as it was before. But I think
> > not printing "killed!" in all cases is cleaner.
> > 
> > > That said, there should be no problem using SIGUSR2 for more explicit
> > > control of worker processes.


More information about the Mercurial-devel mailing list