[New-bugs-announce] [issue15896] Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS

Vitaly report at bugs.python.org
Mon Sep 10 01:04:39 CEST 2012


New submission from Vitaly:

Python 2.6.7 on Mac OS 10.7.4 running on MacBookPro laptop.


run attachment as: python test_pipe_error.py

The test() function makes multiple calls to _execute_child() in a loop. Every other call to _execute_child() fails with:
=====
os.read(3, 1048576) self pid:  43953
EINVAL FROM TEST:  Traceback (most recent call last):
  File "test_pipe_error.py", line 127, in test
    _execute_child()
  File "test_pipe_error.py", line 95, in _execute_child
    newData = os.read(errpipe_read, rSize)
OSError: [Errno 22] Invalid argument
=====

_execute_child() is based on subprocess.Popen._execute_child, but with most Popen code removed and errpipe_read configured as os.O_NONBLOCK in the parent process.  Raising of an Exception() instance is used to simulate failure in os.execvp() instead of calling os.execvp().

We initially experienced the EINVAL issue in the parent process' os.read call when os.execvp failed in the child (e.g., errno=2, "file not found"), so I stripped the code to bare minimum in order to reproduce the problem with a smaller code snippet.

----------
components: Library (Lib)
files: test_pipe_error.py
messages: 170144
nosy: vitaly
priority: normal
severity: normal
status: open
title: Sporadic EINVAL in nonblocking pipe os.read when forked child fails on Mac OS
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file27160/test_pipe_error.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15896>
_______________________________________


More information about the New-bugs-announce mailing list