Yury Selivanov added the comment: > How do other event loops handle fork? Twisted, Tornado, libuv, libev, libevent, etc.
It looks like using fork() while an event loop is running isn't recommended in any of the above. If I understand the code correctly, libev & gevent reinitialize loops in the forked process (essentially, you have a new loop). I think we have the following options: 1. Document that using fork() is not recommended. 2. Detect fork() and re-initialize event loop in the child process (cleaning-up callback queues, re-initializing selectors, creating new self-pipe). 3. Detect fork() and raise a RuntimeError. Document that asyncio event loop does not support forking at all. 4. The most recent patch by Martin detects the fork() and reinitializes self-pipe and selector (although all FDs are kept in the new selector). I'm not sure I understand this option. I'm torn between 2 & 3. Guido, Victor, Martin, what do you think? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21998> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com