classification
Title: Improve FastChildWatcher with WNOWAIT?
Type: Stage:
Components: asyncio Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: WGH, gvanrossum, vstinner, yselivanov
Priority: normal Keywords:

Created on 2015-12-23 23:58 by WGH, last changed 2015-12-26 03:19 by gvanrossum.

Messages (3)
msg256946 - (view) Author: WGH (WGH) Date: 2015-12-23 23:58
The problem with FastChildWatcher lies in the fact that it can accidentally reap processes that it doesn't watch.

However, os module includes waitid function (since Python 3.3), and it has WNOWAIT flags, which means "return status, let process remain waitable (=don't reap)".

What do you think, can this feature fix the problem with FastChildWatcher?
msg257015 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-12-26 03:11
Hm... Looks like this wouldn't work unless we also implemented the waitid() (note: 'id', not 'pid') syscall, as waitpid() doesn't support this flag (e.g. https://bugzilla.redhat.com/show_bug.cgi?id=840782).
msg257016 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-12-26 03:19
Oh, hm, we do seem to have os.waitid() but not on OS X... Well that makes producing a reasonable patch much more complicated. Maybe you want to add a 3rd ChildWatcher just for Linux (or just for platforms that have os.waitid)? (If so, please submit a PR to https://github.com/python/asyncio, which we use as "upstream".)
History
Date User Action Args
2015-12-26 03:19:19gvanrossumsetmessages: + msg257016
2015-12-26 03:11:12gvanrossumsetmessages: + msg257015
2015-12-23 23:58:04WGHcreate