[issue12114] packaging.util._find_exe_version(): potential deadlock

STINNER Victor report at bugs.python.org
Thu May 19 15:05:02 CEST 2011


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

The following code does deadlock if the subprocess writes a lot of output to stdout and stderr:

    pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
    try:
        stdout, stderr = pipe.stdout.read(), pipe.stderr.read()
    finally:
        pipe.stdout.close()
        pipe.stderr.close()

Popen.communicate() should be used to avoid the issue.

Attached patch uses the .communicate() method and the context manager syntax (with).

----------
components: Library (Lib)
files: packaging_popen_communicate.patch
keywords: patch
messages: 136286
nosy: haypo, tarek
priority: normal
severity: normal
status: open
title: packaging.util._find_exe_version(): potential deadlock
versions: Python 3.3
Added file: http://bugs.python.org/file22029/packaging_popen_communicate.patch

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


More information about the Python-bugs-list mailing list