[New-bugs-announce] [issue6457] subprocess.Popen.communicate can lose data from output/error streams when broken input pipe occures
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.
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.
When the exception is catched Popen object's stdout and stderr members
may not contain data put into stderr/stdout streams by process B.
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)
title: subprocess.Popen.communicate can lose data from output/error streams when broken input pipe occures
versions: Python 2.6
Added file: http://bugs.python.org/file14482/subprocess.Popen.communicate_problem_reproduction.zip
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce