Skip to content

posix subprocess should support timeout when waiting on the errpipe_read pipe #103911

Open
@gpshead

Description

@gpshead

subprocess.py when using _posixsubprocess.c has a pipe that it waits on to indicate that the child process exec system call succeeded, or to report an error from the child up to including an exec failure. Normally this is trivial and instant. But it is technically possible for a system to have other things going on that could lead this to take a while in unusual circumstances:

part = os.read(errpipe_read, 50000)

We should change this to a non-blocking read or poll call and have it support a timeout so that subprocess timeout support works in this scenario.

motivation: trying to debug an unusual process launching issue myself, and this user report: https://discuss.python.org/t/sporadic-hang-in-subprocess-run/26213.

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirtopic-subprocessSubprocess issues.type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions