[New-bugs-announce] [issue35840] Control flow inconsistency on closed asyncio stream
report at bugs.python.org
Mon Jan 28 02:54:05 EST 2019
New submission from Marc Schlaich <marc.schlaich at googlemail.com>:
After closing a StreamWriter the `StreamReaderProtocol.connection_lost` on the other end is not getting called. In this case the StreamReader is at EOF but calling write/drain does not raise any Exception (and sending data to Nirvana).
I would expect that StreamWriter.is_closing returns True after the close and calling write/drain raises immediately and not just after the second call. Please see attached example. I see the same behavior with Proactor and Selector event loop on Windows.
Maybe this is expected behavior. But in this case it is completely undocumented. Should there be a check for `StreamReader.at_eof` (and maybe `StreamReader.exception`) before writing to the StreamWriter?
This might be related to bpo-34176.
nosy: asvetlov, schlamar, yselivanov
title: Control flow inconsistency on closed asyncio stream
versions: Python 3.7
Added file: https://bugs.python.org/file48082/tcp_test.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce