Hi,
stream.read() blocks forever when reading from a pipe with data that is larger than 2 * limit.
stream.read(n) for non-negative n doesn't deadlock in this case.
For example, if asyncio.StreamReader(loop=loop) is replaced with
asyncio.StreamReader(loop=loop, limit=(len(b'data') // 2 - 1))
in examples/subprocess_attach_read_pipe.py then
yield from reader.read() never returns.
It is reproducible for larger limit values if the data to be send is larger than 2*limit.
I've attached the test file that demonstrates it without an external process.
Is it the correct way to connect a read pipe to the event loop?
Related discussion: