[issue21998] asyncio: a new self-pipe should be created in the child process after fork

Guido van Rossum report at bugs.python.org
Mon Sep 15 20:09:35 CEST 2014


Guido van Rossum added the comment:

That sounds about right -- it's a doc issue. Let me propose a paragraph:

"""
NOTE: It is not safe to share an asyncio event loop between processes that are related by os.fork().  If an event loop exists in a process, and that process is forked, the only safe operation on the loop in the child process is to call its close() method.
"""

(I don't want to have to research what the various polling primitives do on fork(), so I don't want to suggest that it's okay to close the loop in the parent and use it in the child.)

A similar note should probably be added to the docs for the selectors module.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21998>
_______________________________________


More information about the Python-bugs-list mailing list