Skip to content

_ProactorBasePipeTransport.abort() after _ProactorBasePipeTransport.close() does not cancel writes #88594

Closed as not planned

Description

@graingert
mannequin
BPO 44428
Nosy @gvanrossum, @asvetlov, @ambv, @1st1, @graingert

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-06-15.21:00:19.644>
labels = ['3.8', '3.9', '3.10', 'expert-asyncio']
title = '_ProactorBasePipeTransport.abort() after _ProactorBasePipeTransport.close() does not cancel writes'
updated_at = <Date 2021-07-12.16:40:18.078>
user = 'https://github.com/graingert'

bugs.python.org fields:

activity = <Date 2021-07-12.16:40:18.078>
actor = 'graingert'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['asyncio']
creation = <Date 2021-06-15.21:00:19.644>
creator = 'graingert'
dependencies = []
files = []
hgrepos = []
issue_num = 44428
keywords = []
message_count = 2.0
messages = ['395896', '396558']
nosy_count = 5.0
nosy_names = ['gvanrossum', 'asvetlov', 'lukasz.langa', 'yselivanov', 'graingert']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue44428'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

Activity

  1. graingert commented on Jun 15, 2021

    graingertmannequin
    MannequinAuthor

    demo program:

    import asyncio
    import socket
    import threading
    
    async def amain():
        family = socket.AddressFamily.AF_INET
        sock = socket.socket(family, socket.SOCK_STREAM)
        sock.settimeout(1)
        sock.bind(('localhost', 0))
        sock.listen()
        host, port = sock.getsockname()[:2]
    
        event = threading.Event()
    
        def serve():
            client, _ = sock.accept()
            with client:
                client.recv(1)
                event.wait()
    
        t = threading.Thread(target=serve, daemon=True)
        t.start()
    
        reader, writer = await asyncio.open_connection(host=host, port=port)
        try:
            while True:
                writer.write(b"\x00" * 4096 * 682 * 2)
                await asyncio.wait_for(writer.drain(), 2)
                print("wrote")
        except asyncio.TimeoutError:
            print("timed out")
    
        writer.close()
        await asyncio.sleep(0)
        writer.transport.abort()
        print("waiting close")
        await writer.wait_closed()  # never finishes on ProactorEventLoop
        print("closed")
        event.set()
        t.join()
    
    asyncio.run(amain())

    it looks like it was fixed for the selector eventloop in 2546a17

    but not for the proactor https://github.com/python/cpython/blame/8fe57aacc7bf9d9af84803b69dbb1d66597934c6/Lib/asyncio/proactor_events.py#L140

  2. graingert commented on Jun 26, 2021

    graingertmannequin
    MannequinAuthor

    nosying the author of the selector_events fix

  3. transferred this issue fromon Apr 10, 2022
  4. kumaraditya303 commented on Jul 9, 2022

    @kumaraditya303
    Contributor

    @gvanrossum Do you recall the details as you fixed the selector event loop race ?

  5. added
    3.11only security fixes
    3.12only security fixes
    and removed on Jul 9, 2022
  6. gvanrossum commented on Jul 10, 2022

    @gvanrossum
    Member

    Sorry, you're on your own here. I have no recollection of this fix.

  7. kumaraditya303 commented on Oct 23, 2022

    @kumaraditya303
    Contributor

    Duplicate of #89237

  8. Repository owner moved this from Todo to Done in asyncioon Oct 23, 2022
  9. kumaraditya303 commented on Oct 23, 2022

    @kumaraditya303
    Contributor

    #98572 fixes this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions