[issue33725] Python crashes on macOS after fork with no exec

Barry A. Warsaw report at bugs.python.org
Tue Nov 13 20:14:28 EST 2018


Barry A. Warsaw <barry at python.org> added the comment:

Hoo boy.  I'm not sure I have the full picture, but things are starting to come into focus.  After much debugging, I've narrowed down at least one crash to urllib.request.getproxies().  On macOS (darwin), this ends up calling _scproxy.get_proxies() which calls into the SystemConfiguration framework.  I'll bet dollars to donuts that that calls into the ObjC runtime.  Thus it is unsafe to call between fork and exec.  This certainly seems to be the case even if the environment variable is set.

The problem is that I think requests.post() probably also ends up in here somehow (still untraced), because by removing our call to urllib.requests.getproxies(), we just crash later on when requests.post() is called.

I don't know what, if anything can be done in Python, except perhaps to document that anything that calls into the ObjC runtime between fork and exec can potentially crash the subprocess.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33725>
_______________________________________


More information about the Python-bugs-list mailing list