Guido van Rossum added the comment:

Actually I expect that if you share an event loop across different processes 
via form, everything's a mess -- whenever a FD becomes ready, won't both the 
parent and the child be woken up?  Then both would attempt to read from it.  
One would probably get EWOULDBLOCK (assuming all FDs are actually in 
non-blocking mode) but it would still be a mess.  The specific mess for the 
self-pipe would be that the race condition it's intended to solve might come 
back.

It's possible that some polling syscall might have some kind of protection 
against forking, but the Python data structures that map FDs to handlers don't 
know that, so it would still be a mess.

Pretty much the only thing you should expect to be able to do safely after 
forking is closing the event loop -- and I'm not even 100% sure that that's 
safe (I don't know what happens to a forked executor).

Is there a use case for sharing an event loop across forking?

----------

_______________________________________
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

Reply via email to