[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

bpo-37424: Avoid a hang in subprocess.run timeout output capture by gpshead · Pull Request #14490 · python/cpython

miss-islington

The Wayback Machine - http://web.archive.org/web/20190921142329/https://github.com/python/cpython/pull/14490

Join GitHub today

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up

Conversation

bpo-37424: Have subprocess use killpg for some timeout kills.

When shell=True the user is often launching a process tree, if we
kill only the shell and it hasn't set itself up as a pgrp leader,
the grandchild processes still run and may have our output handles
open.  Leading us to wait forever when we should be timing out.

This Adds a fractional timeout on the cleanup communicate phase
_and_ will use killpg on the child process group _if_ it is
different from our own as it should be when start_new_session=True
was used.

Azure Pipelines PR #20190910.130 succeeded

Details

bedevere/issue-number Issue number 37424 found

Details

bedevere/news News entry found in Misc/NEWS.d

continuous-integration/appveyor/pr AppVeyor build succeeded

Details

continuous-integration/travis-ci/pr The Travis CI build passed

Details

added a commit to miss-islington/cpython that referenced this pull request

Sep 11, 2019

bpo-37424: Avoid a hang in subprocess.run timeout output capture (pyt…

…honGH-14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d278)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

miss-islington added a commit to miss-islington/cpython that referenced this pull request

Sep 11, 2019

bpo-37424: Avoid a hang in subprocess.run timeout output capture (pyt…

…honGH-14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d278)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-…

…14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d278)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-…

…14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d278)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

vrpolakatcisco added a commit to vrpolakatcisco/cpython that referenced this pull request

Sep 12, 2019

bpo-37424: Avoid a hang in subprocess.run timeout output capture (pyt…

…honGH-14490)

Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.