Yury Selivanov <yseliva...@gmail.com> added the comment:

Even though I committed a version of Dan's patch to 3.7 and 3.8, I've finally 
decided to revert it and do it properly instead.  We should strive to implement 
a proper solution, not commit some half-working code.

A concrete plan (for Python 3.8 probably):

1. Fix BaseDefaultEventLoopPolicy to track PID in its 'get_event_loop()' and 
'set_event_loop()' methods.  If a PID has changed since the last invocation: 
reset its internal local state.

2. Fix _UnixDefaultEventLoopPolicy to check for PID change in 
'get_child_watcher()' and 'set_child_watcher()'.

3. Fix child watcher / event loops to track PID changes too to avoid listening 
for child processes of their parent process.

4. Look at how libuv and other event loops implement fork support. Ideally we 
should be able to shutdown selectors (epoll, kqueue) in forked processes in 
such a way that their parent process isn't affected.

5. Think how we can make 'asyncio.run' fork friendly. Ideally it should 
initialize its own child watcher and remove it when its done.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue22087>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to