Issue 31059: asyncio.StreamReader.read hangs if n<0 (original) (raw)
Issue31059
Created on 2017-07-27 18:13 by s_kostyuk, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg299332 - (view) | Author: Sergey Kostyuk (s_kostyuk) | Date: 2017-07-27 18:13 |
Good day Maybe I misunderstood something, but I'm failed to fetch any data by calling asyncio.StreamReader.read if `n` is less than zero (or left default). It just hangs in the loop forever (see line number 614 of asyncio/streams.py: https://github.com/python/cpython/blob/3e56ff0/Lib/asyncio/streams.py#L614). If `n` is equal to any positive value - coroutine works as expected and returns if there is any data in socket buffer. Even if available data size is less than `n` bytes. Expected behavior: collect all data from the buffer and return Current behavior: hangs in the loop forever if n < 0 My usage sample: https://git.io/v7nJq | ||
msg308793 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2017-12-20 19:39 |
`.read(-1)` reads up to end of stream (closing the underlying socket by peer). If other side doesn't close connection after sending data -- read(-1) hangs, but it is not asyncio bug. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:49 | admin | set | github: 75242 |
2017-12-20 19:39:10 | asvetlov | set | status: open -> closednosy: + asvetlovmessages: + resolution: not a bugstage: resolved |
2017-07-27 18:13:39 | s_kostyuk | create |