
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2015-10-19 14:12 bysebastien.bourdeauducq, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Messages (5) | |||
|---|---|---|---|
| msg253181 -(view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq)* | Date: 2015-10-19 14:12 | |
1. Open a listening socket:$ nc6 -l -p 10662. Run the following (tested here on Linux):import asyncioasync 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?) | |||
| msg253182 -(view) | Author: Guido van Rossum (gvanrossum)*![]() | Date: 2015-10-19 14:46 | |
See also this upstream git issue:https://github.com/python/asyncio/issues/263. Let me know whether the patch suggested there works for you, and I'll prioritize getting it checked in. (Help would also be appreciated, e.g. in the form of a unittest.) | |||
| msg253184 -(view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq)* | Date: 2015-10-19 16:19 | |
Yes, this patch fixes the problem (in both this example and my real application). Thanks! | |||
| msg253186 -(view) | Author: Guido van Rossum (gvanrossum)*![]() | Date: 2015-10-19 19:02 | |
Fixed by17f76258d11d,d30fbc55194d and08adb4056b5f. | |||
| msg253187 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-10-19 19:10 | |
New changeset17f76258d11d by Guido van Rossum in branch '3.4':Issue#25441: asyncio: Raise error from drain() when socket is closed.https://hg.python.org/cpython/rev/17f76258d11dNew changesetd30fbc55194d by Guido van Rossum in branch '3.5':Issue#25441: asyncio: Raise error from drain() when socket is closed. (Merge 3.4->3.5)https://hg.python.org/cpython/rev/d30fbc55194dNew changeset08adb4056b5f by Guido van Rossum in branch 'default':Issue#25441: asyncio: Raise error from drain() when socket is closed. (Merge 3.5->3.6)https://hg.python.org/cpython/rev/08adb4056b5f | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:22 | admin | set | github: 69627 |
| 2015-10-19 19:10:21 | python-dev | set | nosy: +python-dev messages: +msg253187 |
| 2015-10-19 19:02:16 | gvanrossum | set | status: open -> closed assignee:gvanrossum resolution: fixed messages: +msg253186 |
| 2015-10-19 16:19:53 | sebastien.bourdeauducq | set | messages: +msg253184 |
| 2015-10-19 14:47:14 | gvanrossum | set | versions: + Python 3.4, Python 3.6 |
| 2015-10-19 14:46:57 | gvanrossum | set | messages: +msg253182 |
| 2015-10-19 14:12:10 | sebastien.bourdeauducq | create | |