Author neologix
Recipients gvanrossum, neologix
Date 2013-12-01.12:09:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385899755.41.0.415738852454.issue19850@psf.upfronthosting.co.za>
In-reply-to
Content
asyncio makes heavy use of SIGCHLD for subprocesses.
A consequence of this if that a lot of syscalls can fail with EINTR (see e.g. issue #18885).

The attached patch uses SA_RESTART (through signal.siginterrupt()) to limit EINTR occurrences, e.g. :
"""
$ ./python -c "import os; from signal import *; signal(SIGALRM, lambda *args: None); alarm(1); os.read(0, 1)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
InterruptedError: [Errno 4] Interrupted system call
"""

With siginterrupt(False):
"""
$ ./python -c "import os; from signal import *; signal(SIGALRM, lambda *args: None); siginterrupt(SIGALRM, False); alarm(1); os.read(0, 1)"
[manual interruption]
^CTraceback (most recent call last):
  File "<string>", line 1, in <module>
KeyboardInterrupt
"""

It doesn't come with test because it's hard to come up with a syscall that's guaranteed to be restarted on al OS (and also because I'm having a hard time with all those mock-based asyncio tests ;-), but at least it doesn't break the test suite :-)

See https://groups.google.com/d/topic/python-tulip/9T2_tGWe0Sc/discussion for more background.
History
Date User Action Args
2013-12-01 12:09:15neologixsetrecipients: + neologix, gvanrossum
2013-12-01 12:09:15neologixsetmessageid: <1385899755.41.0.415738852454.issue19850@psf.upfronthosting.co.za>
2013-12-01 12:09:15neologixlinkissue19850 messages
2013-12-01 12:09:15neologixcreate