GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — asyncio hang in subprocess wait_closed() on Windows, BrokenPipeError · Issue #89237 · python/cpython

asyncio hang in subprocess wait_closed() on Windows, BrokenPipeError #89237

New issue
Copy link
New issue
Copy link
Closed
Closed
asyncio hang in subprocess wait_closed() on Windows, BrokenPipeError#89237
Copy link
Assignees
kumaraditya303
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

byllyfish
mannequin
opened on Sep 1, 2021
Issue body actions
BPO 45074
Nosy @asvetlov, @1st1
Files
  • wait_closed.py: demonstrate hang in stream.wait_closed()
  • 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 2021-09-01.05:10:33.552>
    labels = ['type-bug', '3.9', '3.10', 'expert-asyncio']
    title = 'asyncio hang in subprocess wait_closed() on Windows, BrokenPipeError'
    updated_at = <Date 2021-09-01.05:10:33.552>
    user = 'https://bugs.python.org/byllyfish'

    bugs.python.org fields:

    activity = <Date 2021-09-01.05:10:33.552>
    actor = 'byllyfish'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['asyncio']
    creation = <Date 2021-09-01.05:10:33.552>
    creator = 'byllyfish'
    dependencies = []
    files = ['50250']
    hgrepos = []
    issue_num = 45074
    keywords = []
    message_count = 1.0
    messages = ['400810']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'yselivanov', 'byllyfish']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45074'
    versions = ['Python 3.9', 'Python 3.10']

    Activity

    1. byllyfish commented on Sep 1, 2021

      @byllyfish
      byllyfishmannequin
      on Sep 1, 2021
      MannequinAuthor
      More actions

      I have a reproducible case where stdin.wait_closed() is hanging on
      Windows. This happens in response to a BrokenPipeError. The same code
      works fine on Linux and MacOS.

      Please see the attached code for the demo.

      I believe the hang is related to this debug message from the logs:

      DEBUG <_ProactorWritePipeTransport closing fd=632>: Fatal write error on pipe transport
      Traceback (most recent call last):
        File "C:\hostedtoolcache\windows\Python\3.9.6\x64\lib\asyncio\proactor_events.py", line 379, in _loop_writing
          f.result()
        File "C:\hostedtoolcache\windows\Python\3.9.6\x64\lib\asyncio\windows_events.py", line 812, in _poll
          value = callback(transferred, key, ov)
        File "C:\hostedtoolcache\windows\Python\3.9.6\x64\lib\asyncio\windows_events.py", line 538, in finish_send
          return ov.getresult()
      BrokenPipeError: [WinError 109] The pipe has been ended

      It appears that the function that logs "Fatal write error on pipe transport" also
      calls _abort on the stream. If _abort is called before stdin.close(), everything is okay.
      If _abort is called after stdin.close(), stdin.wait_closed() will hang.

      Please see issue bpo-44428 for another instance of a similar hang in wait_closed().

    2. byllyfish
      added
      3.9 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      topic-asyncio
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Sep 1, 2021
    3. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    4. ezio-melotti
      added this to asyncioon Jun 20, 2022
    5. ezio-melotti
      moved this to Todo in asyncioon Jul 17, 2022
    6. kumaraditya303 commented on Oct 23, 2022

      @kumaraditya303
      kumaraditya303
      on Oct 23, 2022
      Contributor
      More actions

      This bug is another instance of protocol.connection_lost callback not getting called correctly. With #98572 the callback is always called which fixes the issue.

      With fix output:

      Running Debug|x64 interpreter...
      BrokenPipe 1 - correct
      BrokenPipe 2 - correct
      
    7. kumaraditya303
      self-assigned this
      on Oct 23, 2022
    8. kumaraditya303
      added
      3.11only security fixesonly security fixes
      3.12only security fixesonly security fixes
      and removed
      3.9 (EOL)end of lifeend of life
      on Oct 23, 2022
    9. gvanrossum
      added a commit that references this issue on Oct 24, 2022

      GH-89237: fix hang in proactor `subprocess.wait_closed()` (#98572)

      ad1dc3e
    10. miss-islington
      added 3 commits that reference this issue on Oct 24, 2022

      pythonGH-89237: fix hang in proactor `subprocess.wait_closed()` (pyth…

      018776c

      pythonGH-89237: fix hang in proactor `subprocess.wait_closed()` (pyth…

      78ca5ae

      GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572)

      8ba086f
    11. gvanrossum
      added a commit that references this issue on Oct 25, 2022

      [3.11] GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-…

      8950689
    12. gvanrossum
      closed this as completedon Oct 25, 2022
    13. Repository owner moved this from Todo to Done in asyncioon Oct 25, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @kumaraditya303
      kumaraditya303

    Labels

    3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • asyncio
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.