This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2015年10月19日 14:12 by sebastien.bourdeauducq, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg253181 - (view) | Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * | Date: 2015年10月19日 14:12 | |
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?)
|
|||
| msg253182 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | 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) * (Python committer) | Date: 2015年10月19日 19:02 | |
Fixed by 17f76258d11d, d30fbc55194d and 08adb4056b5f. |
|||
| msg253187 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年10月19日 19:10 | |
New changeset 17f76258d11d 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/17f76258d11d New changeset d30fbc55194d 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/d30fbc55194d New changeset 08adb4056b5f 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 | |