-
-
Notifications
You must be signed in to change notification settings - Fork 32k
_ProactorBasePipeTransport.abort() after _ProactorBasePipeTransport.close() does not cancel writes #88594
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
Comments
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 |
nosying the author of the selector_events fix |
@gvanrossum Do you recall the details as you fixed the selector event loop race ? |
Sorry, you're on your own here. I have no recollection of this fix. |
Duplicate of #89237 |
#98572 fixes this |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: