Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio subprocess cannot read from /dev/stdin #90522

Closed
xopham mannequin opened this issue Jan 13, 2022 · 4 comments
Closed

asyncio subprocess cannot read from /dev/stdin #90522

xopham mannequin opened this issue Jan 13, 2022 · 4 comments
Labels
topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@xopham
Copy link
Mannequin

xopham mannequin commented Jan 13, 2022

BPO 46364
Nosy @asvetlov, @1st1, @xopham
PRs
  • bpo-46364: Use sockets only for stdin of asyncio on AIX #30596
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2022-01-13.08:18:32.782>
    labels = ['type-bug', 'expert-asyncio']
    title = 'asyncio subprocess cannot read from /dev/stdin'
    updated_at = <Date 2022-02-01.18:11:58.688>
    user = 'https://github.com/xopham'

    bugs.python.org fields:

    activity = <Date 2022-02-01.18:11:58.688>
    actor = 'xoph'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['asyncio']
    creation = <Date 2022-01-13.08:18:32.782>
    creator = 'xoph'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46364
    keywords = ['patch']
    message_count = 3.0
    messages = ['410466', '410467', '412297']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'yselivanov', 'xoph']
    pr_nums = ['30596']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46364'
    versions = []

    @xopham xopham mannequin added topic-asyncio type-bug An unexpected behavior, bug, or error labels Jan 13, 2022
    @xopham
    Copy link
    Mannequin Author

    xopham mannequin commented Jan 13, 2022

    asyncio.create_subprocess_exec and asyncio.create_subprocess_shell fail with "No such device or address" when called on a program that attempts to invoke /dev/stdin on Linux.
    This happens in contrast to the subprocess module and was discussed in the this thread: https://stackoverflow.com/questions/70624413/how-to-read-from-dev-stdin-with-asyncio-create-subprocess-exec

    It seems while subprocess uses a pipe, asyncio uses socket.socketpair() to communicate with the subprocess which in turn appears to fail for /dev/stdin

    @asvetlov
    Copy link
    Contributor

    True. Would you make a pull request that uses socketpair on AIX only?
    A test for desired behavior is required.

    @xopham
    Copy link
    Mannequin Author

    xopham mannequin commented Feb 1, 2022

    Created a PR: #30596

    It's ready for review. Happy about any feedback!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    tifv added a commit to tifv/cpython that referenced this issue Jul 18, 2022
    Subprocess opening /dev/stdin fails if it is a socketpair.
    xopham pushed a commit to xopham/cpython that referenced this issue Aug 12, 2022
    Subprocess opening /dev/stdin fails if it is a socketpair.
    @xopham
    Copy link
    Contributor

    xopham commented Aug 19, 2022

    @1st1 @asvetlov the associated PR is ready, including tests. It's a small change. Would be happy to move this forward and resolve the issue 🙂

    xopham pushed a commit to xopham/cpython that referenced this issue Oct 13, 2022
    Subprocess opening /dev/stdin fails if it is a socketpair.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-asyncio type-bug An unexpected behavior, bug, or error
    Projects
    Status: Done
    Development

    No branches or pull requests

    3 participants