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.

classification
Title: asyncio: fix waitpid() logic
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, neologix, pitrou, python-dev
Priority: normal Keywords: needs review, patch

Created on 2013-10-20 10:33 by neologix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
asyncio_waitpid_loop.diff neologix, 2013-10-20 10:33 review
Messages (6)
msg200561 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-10-20 10:33
The current SIGCHILD handler has two bugs:
- it reschedules itself if waitpid() returns 0: so if this ever happens, it will enter a busy-loop until all children have exited
- it doesn't reschedule itself if waitpid() succeeds in reaping a child: since signals can be coalesced, we must keep calling waitpid() as long as it succeeds, since the incoming SIGCHLD signal could actually be due to more than one child exited (and there won't be a SIGCHILD coming later for the processes we didn't wait right away).
msg200596 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-10-20 16:37
Ah, sorry, I didn't see this before reviewing your other change to the same code.  Your 2nd bullet is http://code.google.com/p/tulip/issues/detail?id=68
msg200626 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-20 19:59
Unrelated, but transp._process_exited will be called from the main thread even if the loop is running from another thread. Shouldn't call_soon_threadsafe be used here?
msg200627 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-20 20:05
Sorry, scratch that. add_signal_handler() won't even accept being called from a non-main thread, according to the comments.
msg200636 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-10-20 21:03
CF, feel free to commit this fix too.

--Guido van Rossum (sent from Android phone)
On Oct 20, 2013 1:05 PM, "Antoine Pitrou" <report@bugs.python.org> wrote:

>
> Antoine Pitrou added the comment:
>
> Sorry, scratch that. add_signal_handler() won't even accept being called
> from a non-main thread, according to the comments.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue19310>
> _______________________________________
>
msg200640 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-20 21:23
New changeset 28397ecf2316 by Charles-François Natali in branch 'default':
Issue #19310: asyncio: fix child processes reaping logic.
http://hg.python.org/cpython/rev/28397ecf2316
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63509
2013-10-20 22:32:56gvanrossumsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-10-20 21:23:39python-devsetnosy: + python-dev
messages: + msg200640
2013-10-20 21:03:56gvanrossumsetmessages: + msg200636
2013-10-20 20:05:19pitrousetmessages: + msg200627
2013-10-20 19:59:06pitrousetnosy: + pitrou
messages: + msg200626
2013-10-20 16:37:52gvanrossumsetmessages: + msg200596
2013-10-20 10:33:29neologixcreate