[PATCH] worker: ensure a posix worker exits with os._exit

Jun Wu quark at fb.com
Tue Aug 9 11:20:01 EDT 2016


Excerpts from Yuya Nishihara's message of 2016-08-09 23:45:37 +0900:
> I agree we should call _exit(), but the problem wouldn't be that simple. My
> understanding is that worker has to propagate an exception so that it will
> be caught at dispatch._runcatch() and mapped to an appropriate warning and
> exit code.

How about extracting dispatch's error handling logic and reuse it here?

By the way, there is a separate issue about sshpeer.cleanup: it can lead to
deadlock reading peer.pipee, if any other forked process keeps its pipeo
open at the time - thus the remote does not get EOF for its stdin and won't
end.

I think ideally we want to close the fds after fork. But Python 2.x does not
support "afterfork" hook. I guess there may be other places with a similar
need - cleanup after "forked". I'm not sure if introducing something like
github.com/google/python-atfork is a good idea or not.


More information about the Mercurial-devel mailing list