New submission from Sebastien Bourdeauducq: 1. Open a listening socket: $ nc6 -l -p 1066
2. Run the following (tested here on Linux): import asyncio async def bug(): reader, writer = await asyncio.open_connection("::1", "1066") while True: writer.write("foo\n".encode()) await writer.drain() # Uncommenting this makes drain() raise BrokenPipeError # when the server closes the connection. #await asyncio.sleep(0.1) loop = asyncio.get_event_loop() loop.run_until_complete(bug()) 3. Terminate netcat with Ctrl-C. The program will go on a endless loop of "socket.send() raised exception." as writer.drain() fails to raise an exception to report the closed connection. Reducing the output rate of the program by using asyncio.sleep causes writer.drain() to raise BrokenPipeError (and shouldn't it be ConnectionResetError?) ---------- components: asyncio messages: 253181 nosy: gvanrossum, haypo, sebastien.bourdeauducq, yselivanov priority: normal severity: normal status: open title: StreamWriter.drain() unreliably reports closed sockets versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25441> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com