[New-bugs-announce] [issue6457] subprocess.Popen.communicate can lose data from output/error streams when broken input pipe occures

Dariusz Walczak report at bugs.python.org
Fri Jul 10 14:36:05 CEST 2009


New submission from Dariusz Walczak <dariusz.walczak at gmail.com>:

It's possible to lose data piped through standard output and/or error
streams when large ammounts of data are transfered.

Reproduction:
1) Process A spawns process B with all standard I/O pipes and transfers
large ammount of data to it (100kB in my sample).
2) Process B exits very early (doesn't process all stdin data) and puts
large amount of data into its stderr or stdout streams.
3) IOError/OSError exception if errno variable set to errno.EPIPE is
raised on process A side.

Bug:
When the exception is catched Popen object's stdout and stderr members
may not contain data put into stderr/stdout streams by process B.

Note:
Described behaviour can be observed in Python 2.6.1 on FreeBSD 7.2 as
well as on Windows XP (Pro x64, SP2, up to date).

Real life example of such early end of process B:
openssl smime -verify -CApath /some/dir with large, unsigned email.

I attach simple reproduction code (execute sender.py script).

----------
components: Library (Lib)
files: subprocess.Popen.communicate_problem_reproduction.zip
messages: 90391
nosy: dwalczak
severity: normal
status: open
title: subprocess.Popen.communicate can lose data from output/error streams when broken input pipe occures
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file14482/subprocess.Popen.communicate_problem_reproduction.zip

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


More information about the New-bugs-announce mailing list