This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martius
Recipients gvanrossum, martius, neologix, vstinner, yselivanov
Date 2015-02-17.21:30:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424208623.96.0.553883282509.issue21998@psf.upfronthosting.co.za>
In-reply-to
Content
The goal of the patch is to create a duplicate selector (a new epoll() structure with the same watched fds as the original epoll). It allows to remove fds watched in the child's loop without impacting the parent process.

Actually, it's true that with the current implementation of the selectors module (using get_map()), we can achieve the same result than with victor's patch without touching the selector module. I attached a patch doing that, also working with python 3.4.

I thought about this at_fork() mechanism a bit more and I'm not sure of what we want to achieve with this. In my opinion, most of the time, we will want to recycle the loop in the child process (close it and create a new one) because we will not want to have the tasks and callbacks scheduled on the loop running on both the parent and the child (it would probably result in double writes on sockets, or double reads, for instance).

With the current implementation of asyncio, I can't recycle the loop for a single reason: closing the loop calls _close_self_pipe() which unregisters the pipe of the selector (hence breaking the loop in the parent). Since the self pipe is an object internal to the loop, I think it's safe to close the pipes without unregistering them of the selector. It is at least true with epoll() according to the documentation quoted by neologix, but I hope that we can expect it to be true with other unix platforms too.
History
Date User Action Args
2015-02-17 21:30:24martiussetrecipients: + martius, gvanrossum, vstinner, neologix, yselivanov
2015-02-17 21:30:23martiussetmessageid: <1424208623.96.0.553883282509.issue21998@psf.upfronthosting.co.za>
2015-02-17 21:30:23martiuslinkissue21998 messages
2015-02-17 21:30:23martiuscreate